On a button click I am showing a popover view which is a tableview.
Everything seems to work and the view shows but then disappears in less than a second.
The tableview contains a list of strings and I set the tablecell to be show checkmark.
I notice that table shows all items checked in the split second it is displayed
Anyone knows what I am missing.
Thanks
Hassan
Code to show the popover
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"WholesalersList"]){
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
WholesalersViewController *vc = segue.destinationViewController;
vc.wholesalers = [appDelegate.wholesalers mutableCopy];
if ([segue isKindOfClass:[UIStoryboardPopoverSegue class]]){
self.wholesalersPopoverController = [(UIStoryboardPopoverSegue *)segue popoverController];
[self.wholesalersPopoverController setPopoverContentSize:CGSizeMake(334, 334)];
//[self.wholesalersPopoverController setDelegate:self];
}
}
}
Code in the popover tableview
#pragma mark Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)theTableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)theTableView numberOfRowsInSection:(NSInteger)section {
if ([self.wholesalers count] == 0) {
return 1;
}
else {
return [self.wholesalers count];
}
}
#pragma mark Table view delegate
- (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if ([self.wholesalers count] == 0) {
return nil;
}
else {
static NSString *CellIdentifier = @"WholesalerCell";
UITableViewCell *cell = [theTableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Configure the cell.
Wholesaler *ws = (Wholesaler *)[self.wholesalers objectAtIndex:indexPath.row];
cell.textLabel.text = ws.name;
return cell;
}
}
- (CGFloat)tableView:(UITableView *)theTableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 44;
}
- (void)tableView:(UITableView *)theTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
}
- (void)tableView:(UITableView *)theTableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
}
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
return NO; // The table view should not be re-orderable.
}