一、页面加载时选中tableview中的第一行
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
NSIndexPath *cellPath=[NSIndexPath indexPathForItem:0 inSection:0];
[self.tableView selectRowAtIndexPath:cellPath animated:NO scrollPosition:UITableViewScrollPositionNone];
[self tableView:self.tableView didSelectRowAtIndexPath:cellPath];
}
必须在viewWillAppear中写