美文网首页
iOS11 tableView-reloadData后setCo

iOS11 tableView-reloadData后setCo

作者: 柯索 | 来源:发表于2020-07-22 18:24 被阅读0次

解决办法之一

[self.tableView reloadData]

[self.tableView layoutIfNeeded]; //加上这段代码,

[self.tableView setContentOffset:设置你的偏移量)];

注: 不能完全解决滚动后存在一定偏移量, 在刷新数据源的情况下, 滚动到相应的位置.

还需要加上

tableView.estimatedRowHeight = 0

tableView.estimatedSectionHeaderHeight = 0

tableView.estimatedSectionFooterHeight = 0

完美解决!!

转载链接:https://www.jianshu.com/p/6935ef251cfb

相关文章

网友评论

      本文标题:iOS11 tableView-reloadData后setCo

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