UITableView进阶,cell刷新,界面返回 保持所选cell

1.cell 刷新

NSIndexPath  *indexPath_1=[NSIndexPath indexPathForRow:1 inSection:0];
NSArray      *indexArray=[NSArray  arrayWithObject:indexPath_1];

[_tableView reloadRowsAtIndexPaths:indexArray withRowAnimation:UITableViewRowAnimationNone];

  

2.界面返回,保持所选cell

-(void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    NSIndexPath *selected = [_tableView indexPathForSelectedRow];
    if(selected) [_tableView selectRowAtIndexPath:selected animated:NO scrollPosition:UITableViewScrollPositionNone];
}

  

posted @ 2016-05-03 21:53  七夜i  阅读(307)  评论(0编辑  收藏  举报