适配 iOS11,避免滚动视图顶部出现20的空白,全局设置了UIScrollView。
if (@available(iOS 11.0, *)) { [[UIScrollView appearance] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever]; }
但是在进入系统界面时,系统界面会出现上移的问题。解决方法在进入系统界面时设置一下方法,
if (@available(iOS 11.0, *)) { [[UIScrollView appearance] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentAutomatic]; }
系统界面会调app界面时再设置:UIScrollViewContentInsetAdjustmentNever