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]; }];

猜你喜欢

转载自www.cnblogs.com/huaida/p/12076561.html
今日推荐