iOS11 tableView-reloadData后setContentOffset无效问题解决

解决办法之一

[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后setContentOffset无效问题解决)