There are many answers to the complementary question, which is how to prevent a transition to PrimaryOverLay
on a from Regular
to Compact
interface change, eg use
func splitViewController(splitViewController: UISplitViewController, collapseSecondaryViewController secondaryViewController: UIViewController, ontoPrimaryViewController primaryViewController: UIViewController) -> Bool
In my case, I have an iPhone 6+ with the detail view showing in portrait. When I rotate the device to horizontal (Compact
to Regular
), I want the primary view to stay hidden. I've tried setting the preferredDisplayMode
to .PrimaryHidden
in many places, but it has no apparent affect. Googling has turned up nothing.
Don't override traitCollection
, instead use the method setOverrideTraitCollection:forChildViewController:
in a parent view controller of your split controller, like in Apple's example AAPLTraitOverrideViewController.m
If your split controller doesn't have a parent, making a parent is really easy in the Storyboard. Add a new view controller, make it the entry point, add a container view, delete the default embedded view and instead add an embed segue to the split controller and set the override on self.childViewControllers.firstObject
in viewDidLoad
.