tableView 刷新列表,使用reload/reloadRowsAtIndexPaths:出现界面闪动,怎么办?
最近在实现一个微信朋友圈动态展开收起的功能,展开收起时使用reload界面闪动厉害,后调整为使用reloadRowsAtIndexPaths,依然有闪动出现,又调整了两个地方解决:
1、出现闪动添加以下代码乱跳关掉高度估算
_tableView.estimatedRowHeight = 0;
_tableView.estimatedSectionFooterHeight = 0;
_tableViewestimatedSectionHeaderHeight = 0;
2、若是使用reloadRowsAtIndexPaths刷新可添加以下代码通过block关掉动画
[UIView performWithoutAnimation:^{
[weakself.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
}];
本文讲述了在实现微信朋友圈动态展开收起功能时,作者遇到表格视图(tableView)刷新导致界面闪动的问题。通过调整estimatedRowHeight、estimatedSectionFooterHeight和estimatedSectionHeaderHeight为0,以及使用withoutAnimation块关闭动画,成功减少了闪动现象。
5790

被折叠的 条评论
为什么被折叠?



