美文网首页
UITableView

UITableView

作者: kangomake | 来源:发表于2019-03-18 17:28 被阅读0次

1.[self.tableView reloadData]

tableView调用reloadData之后,立即调用numberOfRowsInSection,但是cellForRowAtheightForRow是异步调用
想要调用reloadData 之后立即调用所有代理方法,我们可以添加layoutIfNeeded 让TableView强制布局

self.tableView.reloadData()
self.tableView.layoutIfNeeded()

2.tableView刷新部分cell

//刷新一行
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:index inSection:0];
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationFade];

//刷新一组
NSIndexSet* indexSet = [[NSIndexSetalloc]initWithIndex:1];
[self.myTableViewreloadSections:indexSetwithRowAnimation:UITableViewRowAnimationAutomatic];



相关文章

网友评论

      本文标题:UITableView

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