美文网首页ios开发的那些坑
iOS-加载更多列表不流畅的问题

iOS-加载更多列表不流畅的问题

作者: fly大梦想家 | 来源:发表于2018-07-03 16:30 被阅读61次

下拉刷新,上拉加载更多页面是自己封装的,在加载更多的时候出现了列表不顺畅的感觉,显示如下:


列表加载更多显示不顺畅.gif

错误显示例如:第二次加载更多之前,页面的最后一条评论时"如果每天的新闻朗读如社长般就完美了",加载之后这条评论跳到了页面中间

(正常情况是这条评论还在页面底部,新加载出来的评论跟在它下面还未显示)

解决方法如下:

    self.listTableView.estimatedRowHeight = 0;
    self.listTableView.estimatedSectionHeaderHeight = 0;
    self.listTableView.estimatedSectionFooterHeight = 0;
@property (nonatomic) CGFloat estimatedRowHeight NS_AVAILABLE_IOS(7_0); // default is UITableViewAutomaticDimension, set to 0 to disable
@property (nonatomic) CGFloat estimatedSectionHeaderHeight NS_AVAILABLE_IOS(7_0); // default is UITableViewAutomaticDimension, set to 0 to disable
@property (nonatomic) CGFloat estimatedSectionFooterHeight NS_AVAILABLE_IOS(7_0); // default is UITableViewAutomaticDimension, set to 0 to disable

分析原因:
上面三个属性默认是自动维度(字面翻译)?设置为0可禁止
因为我cell的高度都是根据评论内容来确定的,这三个系统的属性可能对高度的计算产生了影响

解决后显示情况:


列表加载正常显示.gif

再次加载列表很流畅了

相关文章

网友评论

本文标题:iOS-加载更多列表不流畅的问题

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