You can create a custom modal presentation without using your custom presentation controller by specifying the system-provided UIModalPresentationStyle
when presenting your view controller. Here's an example:
let viewController = MyViewController()
// Specify the built-in modal presentation style
viewController.modalPresentationStyle = .fullScreen
// Present the view controller
present(viewController, animated: true, completion: nil)
In this example, we create an instance of MyViewController
and set its modalPresentationStyle
property to .fullScreen
, which is a built-in style provided by UIKit. We then call present(_:animated:completion:)
to present the view controller using the system-provided modal presentation.
By doing this, we effectively ignore any custom presentation controller that we may have set up for MyViewController
.
Asked: 2022-06-14 11:00:00 +0000
Seen: 14 times
Last updated: Jul 01 '21