美文网首页iOS开发
关于tableView刷新时,刷新的位置与之前位置不符解决方案

关于tableView刷新时,刷新的位置与之前位置不符解决方案

作者: 灬小五灬 | 来源:发表于2018-01-26 16:42 被阅读0次

关于tableView刷新时,刷新的位置与之前位置不符解决方案:

由于iOS 11新特性导致问题,目前自己已找到的解决方案:
以下三个属性在 iOS11新特性下可以防止刷新tableView cell对应不上

 tableView.estimatedRowHeight = 0;
 tableView.estimatedSectionHeaderHeight = 0;
 tableView.estimatedSectionFooterHeight = 0;

也有人说可以用下面的这个方法可以解决,本人没有测试这个方法

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSNumber *height = [self.cellHeightArray objectAtIndex:indexPath.row];
    if (height) {
        return height.doubleValue; 
    }
    return UITableViewAutomaticDimension;
}

相关文章

网友评论

    本文标题:关于tableView刷新时,刷新的位置与之前位置不符解决方案

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