1、可能是self.navigationController.navigationBar.translucent = NO
影响起始坐标
iOS7之后由于navigationBar.translucent默认是YES,坐标默认在(0,0)点 ;当不透明的时候(设为NO),零点坐标在(0,64);
如果你想设成透明的,而且还要零点从(0,64)开始,那就添加:self.edgeForExtendedLayout = UIRectEdgeNone;
如果你想设成不透明的,而且还要坐标从(0,0)开始,添加 self.extendedLayoutIncludesOpaqueBars = YES;
2、tableView的设置
if (@available(iOS 11.0, *)) {
for (UIView *view in self.view.subviews) { //遍历子控件得到scrollView,设置scrollView的contentInsetAdjustmentBehavior为UIScrollViewContentInsetAdjustmentNever
if ([view isKindOfClass:[UIScrollView class]]) {
UIScrollView *scrollView = (UIScrollView *)view;
scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
}
} else { //直接设置view的automaticallyAdjustsScrollViewInsets为NO
self.automaticallyAdjustsScrollViewInsets = NO;
}
网友评论