TableView刷新 局部刷新等

时间:2023-03-10 06:38:40
TableView刷新 局部刷新等

1.对整个页面刷新

[ tableView reloadData];

2.对某一个section刷新

NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:2];

[tableview reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];

3.对cell刷新

NSIndexPath *indexPath = [NSIndexPath indexPathForRow:2 inSection:0];

//数组 也就是可以多个cell

[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationAutomatic];