How can I override the trait collection for a view controller with a custom modal presentation style?

1.1k views Asked by At

I have a custom modal presentation style for view controllers in my app that mimics a form sheet, except with some additional visual touches. View controllers that are presented like this make some layout decisions based on attributes of their trait collections (specifically size classes). When this "fake form sheet" presentation is used on an iPad, the presented view controllers inherit the trait collection of the device and layout accordingly. But they really should be different (i.e. horizontally compact, at least).

How can I override the trait collection of a view controller presented with a custom modal presentation style (via UIViewControllerTransitioningDelegate and UIViewControllerAnimatedTransitioning and friends)?

Note: the specific layout issue I'm having is the tab bar in a UITabBarController using iOS 11's new layout with the tab item titles next to the images, when it really should be using the classic / iPhone portrait layout (with titles below images). I'm guessing this is done based on the size class of the view controller.

0

There are 0 answers