0

I am using swift

I am using UISplitView. I have a button on the detail page that when clicked, I would like the master view to display. I have tried:

self.splitViewController?.preferredDisplayMode = UISplitViewControllerDisplayMode.allVisible

but this did not work.

Is there a way to display the master view from a button on the detail page?

lascoff
  • 1,321
  • 4
  • 17
  • 35

1 Answers1

2

I use this same code you have and it works fine when called in the in the Detail View Controller.

 @IBAction func showHideLeftPane(sender: AnyObject) {
    if self.splitViewController?.preferredDisplayMode == UISplitViewControllerDisplayMode.AllVisible {            
        self.splitViewController?.preferredDisplayMode = UISplitViewControllerDisplayMode.PrimaryHidden
    }
    else {
        self.splitViewController?.preferredDisplayMode = UISplitViewControllerDisplayMode.AllVisible
    }

if you do not want the NWSE arrow button placed in the navigation bar..

     override func viewWillAppear(animated: Bool) {
       self.navigationItem.leftBarButtonItems = []
       self.navigationItem.leftItemsSupplementBackButton = false
       super.viewWillAppear(animated)
    }

I hope this helps.

Daryl1109
  • 66
  • 4