iOS 6: Parent modal's modalPresentationStyle ignored after rotation

前端 未结 3 765
太阳男子
太阳男子 2021-02-05 01:47

With iPad with iOS6, we have this bug where a modal view controller will expand to full screen, even if it is told to be using \"form sheet\" presentation style. But, this hap

相关标签:
3条回答
  • 2021-02-05 02:36

    Not sure if this should be considered as a bug and I'm curious what iOS 7 will bring, but the current workaround for this issue is to set modalPresentationStyle to UIModalPresentationCurrentContext for the child-viewController.

    Set modalPresentationStyle = UIModalPresentationCurrentContext
    

    This makes the child still beeing presented as FormSheet but prevents the parent from beeing resized to fullscreen on rotation.

    Dirk

    0 讨论(0)
  • 2021-02-05 02:38

    You need to instanciate your navigation controller after your main view. So that you will be able to manage rotation in each view.

    If your AppDelegate RootViewController is a navigation controller, you will not be able to manage rotation with native functions.

    0 讨论(0)
  • 2021-02-05 02:39

    I can see 2 problems here.

    1) in iOS 6 the method presentModalViewController:animated: is deprecated, try using presentViewController:animated:completion: (despite this might not help, you still may want to do it)

    2) In iOS 6 somehow appeared that container controllers (such as UINavigationController) don't resend the autorotate messages to their children. Try subclassing the UINavigationController and redefine the corresponding autorotation methods to be sent to all of the children. This might help.

    0 讨论(0)
提交回复
热议问题