iOS translucent automaticallyAdjustsScrollViewInsets edgesForExtendedLayout contentInsetAdjustmentBehavior
translucent
self.navigationController.navigationBar.translucent = NO;
ios7 之后iOS7之后由于navigationBar.translucent默认是YES,原点在(0,0)点
当设置NO的时候,原点坐标在(0,64)点开始,屏幕会多一个导航栏的高度
automaticallyAdjustsScrollViewInsets
self.automaticallyAdjustsScrollViewInsets = NO;
self.edgesForExtendedLayout = UIRectEdgeNone;
contentInsetAdjustmentBehavior
iOS11中automaticallyAdjustsScrollViewInsets方法被废弃,我们需要使用UIScrollView的 contentInsetAdjustmentBehavior 属性来替代它.
我们先来看看contentInsetAdjustmentBehavior这个枚举值:
typedef NS_ENUM(NSInteger, UIScrollViewContentInsetAdjustmentBehavior) {
UIScrollViewContentInsetAdjustmentAutomatic, 和scrollableAxes一样,scrollView会自动计算和适应顶部和底部的内边距并且在scrollView 不可滚动时,也会设置内边距.
UIScrollViewContentInsetAdjustmentScrollableAxes, //自动计算内边距.
UIScrollViewContentInsetAdjustmentNever, //不计算内边距,
UIScrollViewContentInsetAdjustmentAlways, //根据safeAreaInsets 计算内边距
} API_AVAILABLE(ios(11.0),tvos(11.0));
self.navigationController.navigationBar.translucent = NO; 相当于self.automaticallyAdjustsScrollViewInsets = NO;self.edgesForExtendedLayout = UIRectEdgeNone;相当于 UIScrollViewContentInsetAdjustmentNever