iOS 13中的modalPresentationStyle默认值 [英] modalPresentationStyle default value in iOS 13

查看:43
本文介绍了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?

推荐答案

  1. UIModalPresentationStyle.automatic 根据显示 UIViewController 的上下文在 .pageSheet .fullScreen 之间切换
  2. 如果您使用的是常规 UIViewController ,则默认为 .pageSheet .
  3. 但是,如果您使用的是 UIViewController 的子类,例如 UIImagePickerController ,iOS希望内容应处于全屏模式,因此默认为 .fullscreen
  4. 如果您使用的 iOS 版本低于 13 ,它将始终默认为 .fullscreen .
  1. UIModalPresentationStyle.automatic switches between .pageSheet and .fullScreen depending on the context in which UIViewController is presented.
  2. If you are using normal UIViewController it will default to .pageSheet.
  3. 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.
  4. If you are using iOS version less than 13 it will always default to .fullscreen.

这篇关于iOS 13中的modalPresentationStyle默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆