Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Presenting modal in iOS 13 fullscreen

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 dismiss the View Controller automatically.

How can I prevent this behaviour and get back to the old fullscreen modal vc?

modal behaviour

Thanks

like image 831
pascalbros Avatar asked Jun 03 '19 23:06

pascalbros


People also ask

How to force the fullscreen card presentation in iOS 13?

With iOS 13, as stated in the Platforms State of the Unionduring the WWDC 2019, Apple introduced a new default card presentation. In order to force the fullscreen you have to specify it explicitly with: let vc = UIViewController() vc.modalPresentationStyle =.fullScreen //or.overFullScreen for transparency

How to make the view controller full screen in iOS 13?

Initially, the default value is fullscreen for modalPresentationStyle, but in iOS 13 its changes to the UIModalPresentationStyle.automatic. If you want to make the full-screen view controller you have to change the modalPresentationStyle to fullScreen.

Does the iOS 13 simulator still default to full screen?

In the past, Apple has often changed defaults only becoming active once you are linking against the current SDK. We will hopefully get the old behavior when linking against previous versions. I can confirm that Xcode-10 built apps run on the iOS 13 simulator do still default to full screen.

Do xcode-10 apps still default to full screen?

I can confirm that Xcode-10 built apps run on the iOS 13 simulator do still default to full screen. As @DrMickeyLauer said, building with Xcode 11 opts the app in to the new behaviour. Use isModalInPresentation to block the swipe gesture from dismissing. See my blog post for more details: medium.com/@hacknicity/…


2 Answers

With iOS 13, as stated in the Platforms State of the Union during the WWDC 2019, Apple introduced a new default card presentation. In order to force the fullscreen you have to specify it explicitly with:

let vc = UIViewController() vc.modalPresentationStyle = .fullScreen //or .overFullScreen for transparency self.present(vc, animated: true, completion: nil) 
like image 169
pascalbros Avatar answered Sep 23 '22 21:09

pascalbros


I add an information that could be useful for someone. If you have any storyboard segue, to go back to the old style, you need to set the kind property to Present Modally and the Presentation property to Full Screen.

enter image description here

like image 43
Alessandro Avatar answered Sep 22 '22 21:09

Alessandro