0

As you know, split view controller hides the master view and displays detail view in full screen mode in ipad. In the full screen mode, ios creates a bar button for the master view on the navigation bar. My question is, is it possible to reposition that button to the far right instead of left? Because my detail view is embedded inside a navigation view controller and there are severals views associated with it. It gets confusing when master view is hidden and the detail view has button to go back to the previous view.

enter image description here

In above screencap, "Category" is a button to display the masterview and "List of Events" is a back button. If you have better way to handle this situation, please feel free to suggest.

KMC
  • 1,677
  • 3
  • 26
  • 55

2 Answers2

0

Yes, you can do it just send a NotificationCenter.default to the split view controller and change self.preferredDisplayMode in your splitview and coming to moving the category buttom u either can use the right bar button in navigationbar or create your custom navigation bar.

Hope this helps

Koushik
  • 1,220
  • 15
  • 19
  • Sorry for late reply. But I'm not sure if I understand your solution, but I found simpler one which I posted below for anyone who has similar issue as mine. – KMC Aug 01 '17 at 14:21
0

For those who are having the same issue, I found a very simple solution. All you need to do is assign the rightBarButtonItems with leftBarButtonItems value and set the leftBarButtonItems to nil. Voila, that's about it.

   if let leftButton = self.navigationItem.leftBarButtonItems {
        self.navigationItem.rightBarButtonItems = leftButton
        self.navigationItem.leftBarButtonItems = nil
    }
KMC
  • 1,677
  • 3
  • 26
  • 55