Universal Storyboard Sizing Popover for iPhone and iPad

288 Views Asked by At

I am using a universal storyboard and sizing to handle both the iPhone and iPad. This has been working well except when it comes to popovers. That is a screen that will be a popover on an iPad but a modal screen on the iPhone. I am finding that the only size class that will impact layout for both is wAny hAny I want to use Final Values for each so that the behavior will be as I want for each device. However, unlike regular screens this type seems to only respond to wAny hAnyfor both iPhone and iPad. Should I not be able to set each separately to accommodate the different devices?

1

There are 1 best solutions below

0
On

Since iOS 8, you don't need to handle popovers separately on different size classes. They are handled automatically by a UIPresentationController.

If the modalpresentationStyle property on the UIViewController is set to UIModalPresentationStyle.Popover, UIKit will present it, using a UIPopoverPresentationController, as a popover on a regular size class (iPad) and modally on the compact class (iPhone).

If you're using storyboards you can control it on the segue and setting the segue attribute as Present As Popver:

enter image description here