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