Tag Archives: UIPopoverPresentationController

How to create Popovers in iOS 9

Screen Shot 2015-10-18 at 08.55.13

iOS 8 introduced a new way of creating Popovers on iPad: instead of using the trusty old (nightmarish) UIPopoverController class, we can now use the UIPopoverPresentationController. It’s available on iPads as well as iPhones.

The great news for us developers is that we no longer have to check what type of device we’re on and present our content accordingly:  we simply present a Popover, and if we happen to be on an iPhone, iOS will automatically show our view controller as an action sheet instead. No other code change or if-then query is necessary.

While this approach was optional in iOS 8, the UIPopoverController is now deprecated and should no longer be used in iOS 9 (and good riddens I say). Both the creation as well as dismissal process have been streamlined, and I find it’s now actually a joy rather than a chore to play with Popovers.

Let’s see how to create a simple Popover Presentation Controller in iOS 9.
Continue reading