天天看点

iOS开发之iOS11频繁刷新TableView向下偏移的问题

创建TableView的时候加入这句代码

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

        self.notificationTabView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;

    } else {

        self.automaticallyAdjustsScrollViewInsets = NO;

    }

如果还不可以的话在加上

- (void)viewWillAppear:(BOOL)animated{

    [super viewWillAppear:animated];

    self.notificationTabView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);

    self.notificationTabView.scrollIndicatorInsets = self.notificationTabView.contentInset;

}

搞定