iOS13 presentViewController的modalPresentationStyle问题


presentViewController的modalPresentationStyle问题:

  首先我们查看一下UIModalPresentationStyle,对比以前的看看有什么变化没有。发现新增了一个枚举值UIModalPresentationAutomatic,默认的就是这个,所以才会弹出不是全屏的界面。

typedef NS_ENUM(NSInteger, UIModalPresentationStyle) {

    UIModalPresentationFullScreen = 0,

    UIModalPresentationPageSheet API_AVAILABLE(ios(3.2)) API_UNAVAILABLE(tvos),

    UIModalPresentationFormSheet API_AVAILABLE(ios(3.2)) API_UNAVAILABLE(tvos),

    UIModalPresentationCurrentContext API_AVAILABLE(ios(3.2)),

    UIModalPresentationCustom API_AVAILABLE(ios(7.0)),

    UIModalPresentationOverFullScreen API_AVAILABLE(ios(8.0)),

    UIModalPresentationOverCurrentContext API_AVAILABLE(ios(8.0)),

    UIModalPresentationPopover API_AVAILABLE(ios(8.0)) API_UNAVAILABLE(tvos),

    UIModalPresentationBlurOverFullScreen API_AVAILABLE(tvos(11.0)) API_UNAVAILABLE(ios) API_UNAVAILABLE(watchos),

    UIModalPresentationNone API_AVAILABLE(ios(7.0)) = -1,

    UIModalPresentationAutomatic API_AVAILABLE(ios(13.0)) = -2,

};

 

 

  注意:presentViewController默认的UIModalPresentationAutomatic推出新的VC的时候,原VC不会调用viewWillDisappear与viewDidDisappear方法;退出新VC时,原VC不会调用viewWillAppear与viewDidAppear方法。

  eg:vcA  presentViewController  vcB

    vcA->vcB:vcA不会调用viewWillDisappear与viewDidDisappear方法;

    vcB->vcA:vcA不会调用viewWillAppear与viewDidAppear方法;

 

如果需要vcA 调用 调用viewWillDisappear与viewDidDisappear   修改modalPresentationStylew为UIModalPresentationFullScreen;

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM