[self.tableView reloadData];
- 刷新特定行的cell
- 適用于更新了cell中的內容,刷新
[self.tableView reloadRowsAtIndexPaths:@[
[NSIndexPath indexPathForRow:0 inSection:0],
[NSIndexPath indexPathForRow:1 inSection:0]
]
withRowAnimation:UITableViewRowAnimationLeft];
- 插入特定行數的cell
- 適用于插入了cell,刷新
[self.tableView insertRowsAtIndexPaths:@[
[NSIndexPath indexPathForRow:0 inSection:0],
[NSIndexPath indexPathForRow:1 inSection:0]
]
withRowAnimation:UITableViewRowAnimationLeft];
- 刪除特定行數的cell
- 適用于刪除了cell,刷新
[self.tableView deleteRowsAtIndexPaths:@[
[NSIndexPath indexPathForRow:0 inSection:0],
[NSIndexPath indexPathForRow:1 inSection:0]
]
withRowAnimation:UITableViewRowAnimationLeft];
數據刷新的原則
- 通過修改模型數據,來修改tableView的展示
- 不要直接修改cell上面子控件的屬性
最后編輯于 :
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。