在iOS11上定义scrollVIew, 内容视图会出现位置偏移的现象.
无论是iPhone X或者iPhone 8 Plus等
解决方法:
if (@available(iOS 11.0, *)) {
self.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
NSLog(@“11.0f”);
} else {
self.automaticallyAdjustsScrollViewInsets = NO;
NSLog(@“10f”);
}
添加上述代码即可