Skip to content

Instantly share code, notes, and snippets.

@indyfromoz
Created August 26, 2013 15:12
Show Gist options
  • Save indyfromoz/6342520 to your computer and use it in GitHub Desktop.
Save indyfromoz/6342520 to your computer and use it in GitHub Desktop.
Selecting a row of a UITableView after it is loaded
// The performSelection: method is a "hack". The default row should be selected
// after the last row is selected in the table view
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self performSelector:@selector(selectDefaultTableRow) withObject:nil afterDelay:0.5];
}
- (void)selectDefaultTableRow
{
[self.reportSummaryTableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] animated:NO scrollPosition:UITableViewScrollPositionNone];
[self.reportSummaryTableView.delegate tableView:self.reportSummaryTableView didSelectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment