5

I am not able to get iOS to display my button to show the UISplitView master view when in portrait mode (iPad) or landscape (iPhone 6+).

Right now I am using the following code, but it's not doing anything...

    detailViewController.navigationItem.leftItemsSupplementBackButton = true
    detailViewController.navigationItem.leftBarButtonItem = displayModeButtonItem()

I tried putting that in the viewDidLoad() of my UISplitView subclass or in the viewDidLoad() of my detail main navigation controller.

It does not seem to do anything so far... Am I missing something ?

Pierre-Olivier
  • 3,104
  • 19
  • 37

1 Answers1

2

It turns out that I was calling these methods on my UINavigationController instead of my UIViewController.

It is now working properly if I do so.

Pierre-Olivier
  • 3,104
  • 19
  • 37
  • Made the same mistake today and spent a few hours trying to figure out what was going wrong. This answer still works today! – Lunarchaos42 Mar 15 '20 at 00:40
  • Could you show what you changed in code, or explain more in detail? Also, in which class is `displayModeButtonItem()` defined? – meaning-matters Apr 25 '21 at 11:40