rvijay007
rvijay007

Reputation: 1357

UISplitViewController - Detail on the Left?

Does anyone know how to reverse the display of the master/detail view controllers in a UISplitViewController? I basically just want to display the master list on the right side of the screen instead of the left, but want to preserve all actions the split view controller does to the master list (hides it and brings it back on screen - just want it to animate from the right instead of the left). I see that ios8 has added some much needed functionality to the UISplitViewController, but I'm not sure how to acheive this one little thing from it. Any suggestions would be greatly appreciated!

Upvotes: 3

Views: 1352

Answers (2)

inthy
inthy

Reputation: 382

For those who want to support earlier versions (iOS 10.x) and probably has necessity to respect UI changes according to such languages as Hebrew, Arabic, etc..

splitViewController.view.semanticContentAttribute = .forceRightToLeft

This answer is nearly 4 years too late, but I also do hope that someone finds it useful

Upvotes: 0

Justin Anderson
Justin Anderson

Reputation: 2130

This is supported as of iOS 11 by UISplitViewController's primaryEdge property. This code snippet makes the master pane show on the right, detail on the left:

func application(_ application: UIApplication,
                 didFinishLaunchingWithOptions
                 launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    let splitViewController = window!.rootViewController as! UISplitViewController
    splitViewController.primaryEdge = .trailing
}

This answer is 3 years too late, but hopefully useful to someone with this question after iOS 11's release.

Upvotes: 5

Related Questions