iOS 13 Modal Presentation的全屏适配

假设你需要保持全屏的segue跳转,发现从iOS 13开始变成了PageSheet的方式。你需要注意一下事项:

如果在iOS 13以后,从UIViewController进行modal跳转,请不要使用Deprecated Segues中的Modal,而是使用Adaptive Segues中的Present Modally。

Screen Shot 2019-11-26 at 9.38.41 AM.png

在Presentation中使用Full Screen。

Screen Shot 2019-11-26 at 9.40.43 AM.png

至于原因,是因为iOS 13的升级,注意以下描述,我做了翻译:

/*
 Defines the presentation style that will be used for this view controller when it is presented modally. Set this property on the view controller to be presented, not the presenter.
 If this property has been set to UIModalPresentationAutomatic, reading it will always return a concrete presentation style. By default UIViewController resolves UIModalPresentationAutomatic to UIModalPresentationPageSheet, but system-provided subclasses may resolve UIModalPresentationAutomatic to other concrete presentation styles. Participation in the resolution of UIModalPresentationAutomatic is reserved for system-provided view controllers.
 Defaults to UIModalPresentationAutomatic on iOS starting in iOS 13.0, and UIModalPresentationFullScreen on previous versions. Defaults to UIModalPresentationFullScreen on all other platforms.
这个属性描述了这个VC被modal跳转的时候使用的样式。在被展示的VC使用这个属性,而不是展示者。这个值的默认值是UIModalPresentationAutomatic(iOS 13或以上),或者UIModalPresentationFullScreen(iOS 13以下或非iOS平台)。UIViewController把UIModalPresentationAutomatic解析成UIModalPresentationPageSheet,但是UIViewController的子类会把UIModalPresentationAutomatic解析成其他值
 */
@property(nonatomic,assign) UIModalPresentationStyle modalPresentationStyle API_AVAILABLE(ios(3.2));
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • /* UIViewController is a generic controller base class th...
    DanDanC阅读 5,944评论 0 2
  • 前言的前言 唐巧前辈在微信公众号「iOSDevTips」以及其博客上推送了我的文章后,我的 Github 各项指标...
    VincentHK阅读 10,814评论 3 44
  • 不管任何App,对于跳转这个最基础的动画都是必须的,而iOS的转场动画不仅只是动画,还涉及层级、跳转限制、携带参数...
    HuberyQing阅读 6,394评论 0 0
  • 更好的阅读体验,请到个人博客阅读: iOS中的系统转场 请忽略标题,😂,本文记录的是对下图所示的Kind, Pre...
    CaryaLiu阅读 7,259评论 0 1
  • 我想我曾经来过这里 弯弯扭扭的小径看不到头 互相交叉着 伸向天际的小河边 连小径上都散落着的树叶 五彩斑斓 光的影...
    苍狼0001阅读 2,118评论 0 0

友情链接更多精彩内容