UIView
-
默认值:
View Controller 的 View 的 safeAreaInsets (在viewDidAppear 查看):- 不在Navigation Controller中:{20, 0, 0, 0 }
- 在Navigation Controller中:{64, 0, 0, 0 }
- View Controller 的 additionalSafeAreaInsets : {0, 0, 0, 0 }
修改后:
修改View Controller 的 additionalSafeAreaInsets 后:
view.safeAreaInsets = view.safeAreaInsets + vc. additionalSafeAreaInsets
UIScrollView
由 contentInsetAdjustmentBehavior 决定:
- never: adjustedContentInset = safeAreaInsets
- always: adjustedContentInset = contentInset + safeAreaInsets
- scrollableAxes:
可滚动方向: adjustedContentInset = contentInset + safeAreaInsets
可不滚动方向:adjustedContentInset = contentInset - automatic:
automaticallyAdjustsScrollViewInsets = YES: adjustedContentInset = contentInset + safeAreaInsets
automaticallyAdjustsScrollViewInsets = NO:与scrollableAxes 相同。