iOS 13中的modalPresentationStyle默认值 [英] modalPresentationStyle default value in iOS 13
本文介绍了iOS 13中的modalPresentationStyle默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
根据Apple文档,
此属性的默认值为UIModalPresentationStyle.automatic
The default value for this property is UIModalPresentationStyle.automatic
在iOS 12中,默认值为UIModalPresentationStyle.fullScreen,这就是我得到的.
In iOS 12, the default value was UIModalPresentationStyle.fullScreen, and that what I get.
但是当我在iOS 13上运行我的应用程序时,我将 .pageSheet命名为navigationController.modalPresentationStyle
But when I am running my app on iOS 13 I am getting .pageSheet as navigationController.modalPresentationStyle
我做错了什么吗,还是默认值为.pageSheet?
Is there anything I am doing wrong or the default value is .pageSheet?
推荐答案
- UIModalPresentationStyle.automatic 根据显示 UIViewController 的上下文在 .pageSheet 和 .fullScreen 之间切换
- 如果您使用的是常规 UIViewController ,则默认为 .pageSheet .
- 但是,如果您使用的是 UIViewController 的子类,例如 UIImagePickerController ,iOS希望内容应处于全屏模式,因此默认为 .fullscreen
- 如果您使用的 iOS 版本低于 13 ,它将始终默认为 .fullscreen .
- UIModalPresentationStyle.automatic switches between .pageSheet and .fullScreen depending on the context in which UIViewController is presented.
- If you are using normal UIViewController it will default to .pageSheet.
- But if you are using some subclass of UIViewController like UIImagePickerController iOS expects content should in full screen mode so it will default to .fullscreen.
- If you are using iOS version less than 13 it will always default to .fullscreen.
这篇关于iOS 13中的modalPresentationStyle默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文