iOS 技术精选集

iOS11 tableView-reloadData后setCo

2019-01-02  本文已影响1人  CarlXu

[self.tableView reloadData];

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

[self.tableView setContentOffset:CGPointMake(0, -navHeight)];

不能完全解决滚动后存在一定偏移量, 在刷新数据源的情况下, 滚动到顶部的问题.

还需要加上

  tableView.estimatedRowHeight = 0

  tableView.estimatedSectionHeaderHeight = 0

  tableView.estimatedSectionFooterHeight = 0

完美解决!!

上一篇 下一篇

猜你喜欢

热点阅读