美文网首页
解决tableView刷新乱跳

解决tableView刷新乱跳

作者: _Jock羁 | 来源:发表于2018-12-26 18:53 被阅读23次

在iOS 11Self-Sizing自动打开后,contentSize和contentOffset都可能发生改变。可以通过以下方式禁用

 self.estimatedRowHeight = 0;
self.estimatedSectionHeaderHeight = 0;

self.estimatedSectionFooterHeight = 0;

在iOS 10 以下 通过以下协议方法设置精准高度就可以了

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(7_0);

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForHeaderInSection:(NSInteger)section NS_AVAILABLE_IOS(7_0);

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForFooterInSection:(NSInteger)section NS_AVAILABLE_IOS(7_0);
--------------------- 

相关文章

网友评论

      本文标题:解决tableView刷新乱跳

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