我想要做的是在我的searchResultsTableView調用selectRowAtIndexPath。我在viewWillAppear中這樣做,以便在從另一個視圖控制器返回後選中該行。在這個簡單的例子中,我只是要求它到第2行。發生的是它簡要地選擇第2行,然後選擇消失。有任何想法嗎?試圖調用selectRowAtIndexPath我的searchController.searchResultsTableView
-(void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// just select row 2 as a test
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:2 inSection:0];
[self.searchController.searchResultsTableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
[self.searchController.searchResultsTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionNone animated:NO];
}
感謝
完美!非常感謝你。埃裏克 –