创建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;
}
搞定