modalPresentationStyle 默认值 iOS 13

modalPresentationStyle default value in iOS 13

根据苹果文档,

The default value for this property is UIModalPresentationStyle.automatic

在iOS 12 中,默认值为UIModalPresentationStyle.fullScreen,这就是我得到的。

但是当我 运行 我的应用在 iOS 13 时,我得到 .pageSheet as navigationController.modalPresentationStyle

有没有我做错了什么或者默认值是.pageSheet?

呈现样式为自动,当您以模态方式呈现 viewcontroller 时,默认为 iOS 13 中的页面表

  1. UIModalPresentationStyle.automatic.pageSheet.fullScreen 之间切换,具体取决于显示 UIViewController 的上下文。
  2. 如果您使用的是普通 UIViewController,它将默认为 .pageSheet.
  3. 但是如果你正在使用 UIViewController 的一些子类,比如 UIImagePickerController iOS 期望内容应该在全屏模式下,所以它将默认为 .fullscreen.
  4. 如果您使用的 iOS 版本低于 13 它将始终默认为 .fullscreen .

The default presentation style chosen by the system. It's UIModalPresentationAutomatic

Automatic 意味着如果我们使用 UIImagePickerController 和 sourceType .photoLibrary 那么它会以级联视图的形式出现。和 sourceType .camera 然后它会全屏显示。

https://developer.apple.com/videos/play/wwdc2019/224/

https://developer.apple.com/documentation/uikit/uimodalpresentationstyle/uimodalpresentationpagesheet?language=objc