Does tableViewController behave incorrectly when hosted by a popoverController?
- by dugla
I have made countless test examples of a tableViewController hosted by a popoverController and I have come to the following conclusion: It does not appear possible to pre-select a tableView cell.
It is possible to do pre-selection when a tableViewController is hosted by a splitviewController.
I am using the exact same tableViewController code. Here is the relevant tableViewController view lifecycle method that is misbehaving:
static BOOL firstTime = YES;
- (void)viewDidAppear:(BOOL)animated {
NSLog(@"Root ViewController - view Did Appear");
[super viewDidAppear:animated];
if (firstTime == YES) {
firstTime = NO;
NSIndexPath *preselectedCell = [NSIndexPath indexPathForRow:5 inSection:0];
[self.tableView selectRowAtIndexPath:preselectedCell
animated:NO
scrollPosition:UITableViewScrollPositionTop];
detailViewController.detailItem =
[NSString stringWithFormat:@"Row %d", preselectedCell.row];
} // if (firstTime == YES)
}
The above code correctly preselects a tableView cell the first time the tableView is unfurled in the splitViewController case (device in portrait mode).
Can someone please, please, explain what I am doing wrong. I am completely stumped.
Thanks,
Doug