适配iOS11&iPhone X
2017-10-31 13:58
267 查看
MJRefresh下拉刷新错乱(refreshheader 一直在页面 上面显示)
如图automaticallyAdjustsScrollViewInsets 在 iOS11 失效。
@property(nonatomic,assign) BOOL automaticallyAdjustsScrollViewInsets API_DEPRECATED_WITH_REPLACEMENT("Use UIScrollView's contentInsetAdjustmentBehavior instead", ios(7.0,11.0),tvos(7.0,11.0)); // Defaults to YES
所以
self.automaticallyAdjustsScrollViewInsets = NO; if (@available(iOS 11.0, *)){ if ([self.bottomScrollView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) { [self.bottomScrollView setContentInsetAdjustmentBehavior: UIScrollViewContentInsetAdjustmentNever]; } }
如果在项目中,有很多页面有 scrollView 或这其子类 刷新等
那么直接采用下面的方法
if (@available(iOS 11.0, *)){ [[UIScrollView appearance] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever]; }
因为项目中用到statusbar的设置,所以导致下面页面显示不对
修改UINavigationBar+Awesome.m 文件中
self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds) + 20)];,
修改:
self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds) + [[UIApplication sharedApplication] statusBarFrame].size.height)];
iPhone x 的改变
statusbar : 20 –>44tabbar : 49 –> 83
这里注意一下:
如果写固定的值的话,那么现在工作来了。666
所以如果要获取 statusbar 的 frame : [[UIApplication sharedApplication] statusBarFrame]
用系统的获取方法,可以以不变应万变、
滑动之后
相关文章推荐
- 适配iOS11& iPhoneX的一些坑
- 适配iOS11&iPhoneX的一些坑
- 适配iOS11& iPhoneX的一些坑
- 适配iOS11&iPhoneX的一些坑
- 适配iOS11&iPhoneX的一些坑
- iPhone屏幕尺寸、分辨率及适配
- iPhone屏幕尺寸、分辨率及适配
- iOS不同版本适配问题(#ifdef __IPHONE_7_0)
- iOS开发- iPhone6/6 Plus适配
- iPhone 6 / 6 Plus 设计·适配方案
- iPhone 6 / 6 Plus 设计·适配方案
- IOS——新建项目的图标和背景适配所有iPhone屏幕尺寸注意事项
- Objective-C ,ios,iphone开发基础:Category(分类,类别,范畴) ,UINavigationBar设置背景图片适配
- H5页面适配所有iPhone和安卓机型的六个技巧
- iphone 适配LaunchImage
- App适配iPhone 6/ Plus和iOS 8:10条小秘诀
- iOS:界面适配(二)--iPhone/iPad适配(关于xib)
- iPhone 6 / 6 Plus 设计·适配方案(真正版)
- iOS 【iOS iPhone屏幕尺寸、分辨率及屏幕适配】
- H5 页面适配所有 iPhone 和安卓机型的六个技巧