hello world
hello world

Reputation: 807

Hide Master View on iPad landscape mode UISplitViewController iOS

I have a FlyoutNavigation component which derives from UISplitViewController, So when I show it in ipad portrait mode, the master view hides by default and I can toggle it properly, but when I change the orientation to landscape the Masterview shows all the time and I cannot even Toggle it.

Is there a way I can hide/unhide it?

Upvotes: 1

Views: 491

Answers (2)

jay patel
jay patel

Reputation: 258

Try in appDelegate like this :

guard let splitViewController = window?.rootViewController as? UISplitViewController  
else { fatalError() }

splitViewController.preferredDisplayMode = .primaryHidden

Upvotes: 1

Atul
Atul

Reputation: 698

Try setting

splitViewController.preferredDisplayMode = UISplitViewControllerDisplayModePrimaryHidden

Upvotes: 2

Related Questions