美文网首页
TableView刷新时候抖动问题

TableView刷新时候抖动问题

作者: guoguojianshu | 来源:发表于2021-05-14 10:45 被阅读0次
在iOS 11Self-Sizing自动打开后,contentSize和contentOffset都可能发生改变。可以通过以下方式禁用

    self.XSTableView.estimatedRowHeight = 0;
    self.XSTableView.estimatedSectionFooterHeight = 0;
    self.XSTableView.estimatedSectionHeaderHeight = 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/zqfqjltx.html