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]; }
解决问题的能力很关键~(iOS开发交流群:219926126)