I have an application that is viewbased and I am adding a tableview as a subview to the main view. I have taken UITableViewDelegate
to respond the table methods.
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
NSIndexPath *indexPath=[NSIndexPath indexPathForRow:0 inSection:0];
[myTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionBottom];
}
The best way to use this in your code, if you want to select any row by default, use in viewDidAppear.