下拉刷新,上拉加载更多页面是自己封装的,在加载更多的时候出现了列表不顺畅的感觉,显示如下:
![](https://img.haomeiwen.com/i2030619/af2f48172267f18d.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的高度都是根据评论内容来确定的,这三个系统的属性可能对高度的计算产生了影响
解决后显示情况:
![](https://img.haomeiwen.com/i2030619/485ccc3a685dd7f9.gif)
再次加载列表很流畅了
网友评论