BUG效果如下
![](https://img.haomeiwen.com/i337235/9399f174b24ce941.gif)
原因是预估高度与实际高度相差太大. 因为提前按设计图预估了高度, 但是对应高度的cell暂时用其他高度相差很大的cell代替.
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
// 活动部分
if (indexPath.section == 0) {
return 130;
}
// 推荐趣友部分
else if (indexPath.section == 1) {
return 160;
}
// 分享部分
else {
return 300;
}
}
上方代码中, 预估高度为300的地方, 实际高度为130. 只要改为130就可以了.
网友评论