局部刷新与全局刷新

在没用的基础上添加再刷新

    //刷新

    //[self.tableView reloadData];

    

    //刷新局部刷新

    NSIndexPath *lastPath = [NSIndexPathindexPathForRow:self.contacts.count -1 inSection:0];

    [self.tableView insertRowsAtIndexPaths:@[lastPath]withRowAnimation:UITableViewRowAnimationFade];

   

//在原有的基础上编辑再刷新

    //局部刷新

    //获取当前刷新的行

    NSInteger  row = [self.contacts indexOfObject:contact];

    NSIndexPath *refreshIndex = [NSIndexPath indexPathForRow:row inSection:0];

    

    [self.tableView reloadRowsAtIndexPaths:@[refreshIndex] withRowAnimation:UITableViewRowAnimationFade];


你可能感兴趣的:(iOS开发)