iOS11 tableView-reloadData后setCo

2020-07-22  本文已影响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

上一篇 下一篇

猜你喜欢

热点阅读