UITableView表视图中数据的刷新操作

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/potato512/article/details/83753258

全部刷新

[self.tableView reloadData];

修改、刷新某个section,即数组array中修改了某个session数据时,刷新数据则使用该语句。

[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:session] withRowAnimation:UITableViewRowAnimationNone];

删除某个section,即数组array中删除了某个session时,刷新数据则使用该语句。

[self.tableView deleteSections:[NSIndexSet indexSetWithIndex:session] withRowAnimation:UITableViewRowAnimationNone];

新增某个section,即数组array中新增了某个session时,刷新数据时则使用该语句。

[self.tableView insertSections:[NSIndexSet indexSetWithIndex:session] withRowAnimation:UITableViewRowAnimationNone];

修改、刷新某个row,即数组array中修改了某个row数据时,刷新数据则使用该语句。

[self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:row inSection:session]] withRowAnimation:UITableViewRowAnimationNone];

删除某个row,即数组array删除了某个row时,刷新数据则使用该语句。

[self.tableView deleteRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:row inSection:session]] withRowAnimation:UITableViewRowAnimationNone];

新增某个row,即数组array新增了某个row时,刷新数据则使用该语句。

[self.tableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:row inSection:session]] withRowAnimation:UITableViewRowAnimationNone];

猜你喜欢

转载自blog.csdn.net/potato512/article/details/83753258