美文网首页
UITableView表视图中数据的刷新操作

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

作者: 番薯大佬 | 来源:发表于2018-11-05 17:26 被阅读10次

    全部刷新

    [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];
    

    相关文章

      网友评论

          本文标题:UITableView表视图中数据的刷新操作

          本文链接:https://www.haomeiwen.com/subject/pposxqtx.html