Presenting modal in iOS 13 fullscreen

后端 未结 30 2090
囚心锁ツ
囚心锁ツ 2020-11-21 06:48

In iOS 13 there is a new behaviour for modal view controller when being presented.

Now it\'s not fullscreen by default and when I try to slide down, the app just dis

相关标签:
30条回答
  • 2020-11-21 07:06

    I had this problem with a video not presenting fullscreen anymore. Added this line, which saved the day :-)

    videoController.modalPresentationStyle = UIModalPresentationFullScreen;
    
    0 讨论(0)
  • 2020-11-21 07:08

    One Liner:

    modalPresentationStyle is required to be set on the navigationController which is being presented.


    iOS 13 and below iOS version fullScreen with overCurrentContext and navigationController

    Tested Code

    let controller = UIViewController()
    let navigationController = UINavigationController(rootViewController: controller)
    navigationController.modalPresentationStyle = .overCurrentContext
    self.navigationController?.present(navigationController, animated: true, completion: nil)
    

    modalPresentationStyle require to set at navigationController.

    0 讨论(0)
  • 2020-11-21 07:08

    I needed to do both:

    1. Set presentation style as Full screen

    2. Set Top bar as Translucent Navigation Bar

    0 讨论(0)
  • 2020-11-21 07:08

    You can easily do so Open your storyboard as source code and search for kind="presentation", in all the seague tag with kind = presentation add a extra attribute modalPresentationStyle="fullScreen"

    0 讨论(0)
  • 2020-11-21 07:08

    Create a category for UIViewController (say UIViewController+PresentationStyle). Add the following code to it.

     -(UIModalPresentationStyle)modalPresentationStyle{
         return UIModalPresentationStyleFullScreen;
    }
    
    0 讨论(0)
  • 2020-11-21 07:10

    Here is an easy solution without coding a single line.

    • Select View Controller in Storyboard
    • Select attribute Inspector
    • Set presentation "Automatic" to "FullScreen" as per below image

    This change makes iPad app behavior as expected otherwise the new screen is displaying in the center of the screen as a popup.

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