Ask Your Question
0

How can I create a custom modal presentation while disregarding my custom presentation controller?

asked 2022-06-14 11:00:00 +0000

huitzilopochtli gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-07-01 04:00:00 +0000

devzero gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-06-14 11:00:00 +0000

Seen: 14 times

Last updated: Jul 01 '21