Presenting modal in iOS 13 fullscreen
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)
New iOS 13 Modal Presentation: Presenting Controller Doesn't Move Down
Turns out the problem was my view controller hierarchy. I was able to fix it by making the presenting view controller the root view controller of my app. First I set the background controller as the root view controller by calling
window.rootViewController = self
and then using my previous code
let controller = storyboard?.instantiateViewController(withIdentifier: "tutorial") as! TutorialController
controller.modalPresentationStyle = .pageSheet
controller.modalTransitionStyle = .coverVertical
present(controller, animated: true, completion: nil)
I presented the view controller. Thanks to everyone who tried to help!
Presenting the ViewController in full screen
In iOS 13 the default presentation style has changed. If you want iOS 12 presentation style, you can change the modalPresentationStyle
to .fullScreen
.
Swift Version
navigation.modalPresentationStyle = .fullScreen
Objective C
navigation.modalPresentationStyle = UIModalPresentationOverFullScreen;
Presenting modal in iOS 13 fullscreen
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)
How to present a popup view in full screen
You could try presenting with the navigation controller.
let storyboard = UIStoryboard(name: "Other", bundle: Bundle.main)
guard let popupVC = storyboard.instantiateViewController(withIdentifier: "PopUpViewController") as? PopUpViewController else {
print("PopUpViewController not found")
return
}
var navigationController = UINavigationController(rootViewController: popupVC)
navigationController.modalPresentationStyle = .fullScreen
self.present(navigationViewController, animated: true, completion: nil)
An alternative would be to use presentViewController
but presentViewController will only present one viewController modally over the currently visible viewController whereas presenting with the navigationController will give the flexibility to push further components on top, providing a smoother navigation experience with go back to previous page kind of behaviour.
modalPresentationStyle default value in iOS 13
- UIModalPresentationStyle.automatic switches between .pageSheet and .fullScreen depending on the context in which UIViewController is presented.
- If you are using normal UIViewController it will default to .pageSheet.
- But if you are using some subclass of UIViewController like UIImagePickerController iOS expects content should in full screen mode so it will default to .fullscreen.
- If you are using iOS version less than 13 it will always default to .fullscreen.
Related Topics
How to Load Image from Local Path iOS Swift (By Path)
How to Create Delegates in Objective-C
Ios Uiimagepickercontroller Result Image Orientation After Upload
Ios 9 Not Opening Instagram App With Url Scheme
How to Easily Resize/Optimize an Image Size With Ios
Move View With Keyboard Using Swift
How to Record Audio on Iphone With Avaudiorecorder
Enterprise App Deployment Doesn't Work on iOS 7.1
Core Data: Quickest Way to Delete All Instances of an Entity
Implicitly Unwrapped Optional Assign in Xcode 8
How to Fix iOS 12 Safari Cors Preflight Error
Loading/Downloading Image from Url on Swift
How to Enable Native Resolution For Apps on Iphone 6 and 6 Plus
Difference Between 'Yyyy' and 'Yyyy' in Nsdateformatter