美文网首页
tableView reload 加载更多数据,tableVie

tableView reload 加载更多数据,tableVie

作者: sjaljlajslkf | 来源:发表于2018-05-14 10:55 被阅读56次

主要原因是 reload 成功后会重新计算contentSize,由于每个cell根据内容多少会有不同的高度的误差。
iOS11以后tableview 的header footer cell 都默认开启Self-Sizing,使得原来默认高度是0,现在却变成了UITableViewAutomaticDimension:
cell不是一次性全部加载出来 所以contentSize和contentOffset值就会发生变化
下面的代码能解决contentSize和contentOffset值变化的问题

_tableReply.estimatedRowHeight =0;
_tableReply.estimatedSectionHeaderHeight =0;
_tableReply.estimatedSectionFooterHeight =0;

我用的是MJrefresh的第三方刷新和加载 一直以为是MJrefresh的问题 结果不是。

相关文章

网友评论

      本文标题:tableView reload 加载更多数据,tableVie

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