iOS Custom UIPresentationController

The purpose of this story is to demonstrate the creation of a custom presentation controller.

In my example, there will be a button on first view controller and when user taps on it, the detail view controller will be opened in a custom presentation controller.

Here’s the first view controller:

We need to create our custom presentation controller. Custom presentation controller has a dimming view which covers all the screen. The height of the detail view controller is 2/3 of the presentation controller and its origin y position starts at 1/3 height of the presentation controller. Of course this is just an example, you can change layout however you wish. Here’s the code for the custom presentation controller:

And the result: