iOS 13适配问题
2019-09-25 本文已影响0人
NanNan
问题1 屏幕下移
点击查看此文章
更新Xcode11以后,在iOS13系统中遇到如下问题
![](https://img.haomeiwen.com/i8492421/57e0432427ed6df6.gif)
注意出现这种情况的原因:
UIViewController中的属性modalPresentationStyle
(该属性是控制器在模态视图中的样式)
- 在iOS13之前默认属性是UIModalPresentationFullScreen;
- 在iOS13默认属性是UIModalPresentationAutomatic;
所以我们只需要手动设置modalPresentationStyle = UIModalPresentationFullScreen;
ViewController *vc = [[ViewController alloc] init];
vc.title = @"presentVC";
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
nav.modalPresentationStyle = UIModalPresentationFullScreen;
[self.window.rootViewController presentViewController:nav animated:YES completion:nil];
问题2 状态栏高度
ios13后弃用
[UIApplication sharedApplication].statusBarFrame.size.height;
改为
[UIApplication sharedApplication].keyWindow.windowScene.statusBarManager.statusBarFrame.size.height;
问题3 网页加载
UIWebView在iOS13弃用了改用WKWebView
问题4 App的logo问题
如果替换过logo,在iOS13 上点击home键,切换到后台,之前被替换的图标会一闪而过。
问题5 暗黑模式
如果不想自己的应用开启暗黑模式,则需要在代码的info.plist文件中配置key值,User Interface Style为Light如图:
![](https://img.haomeiwen.com/i8492421/5ec345e1a8ed90f9.png)