tableView reloadData页面跳动问题

参考:https://www.jianshu.com/p/5f033fdd4ddb

 

一般情况下

if (@available(iOS 11.0, *)) {

        self.estimatedRowHeight = 0;

        self.estimatedSectionFooterHeight = 0;

        self.estimatedSectionHeaderHeight = 0;

        self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;

    }

可以解决

但是如果有切换不同类型cell的需求,还是会跳动

需要将简单的reloadData替换为

[UIView performWithoutAnimation:^{
        [self reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone];
    }];
[UIView performWithoutAnimation:^{
        [self reloadData];
    }];
posted @ 2019-12-21 12:27  怀达  阅读(1512)  评论(0编辑  收藏  举报