0

I added some code to auto display my MenuViewController (SWRevealViewController) but when I do that, my navigation bar of my front view disappear.

There is the code :

if (previousVC == "EditVC")
        {
            self.revealViewController().revealToggleAnimated(true)
            self.revealViewController().setFrontViewController(self, animated: true)
            // navigation bar disappear
        }

I don't understand why my navigation bar is hidden. Can somebody help me?

Michal
  • 162
  • 1
  • 14

2 Answers2

1

It could be that you are setting the front view controller to a view that's not embedded in a Navigation Controller. My suggestion would be to segue normally and then setup your Sidebar menu again in viewDidLoad for the next view controller like so:

        // Implement the menu bar functionality
        if self.revealViewController() != nil {
            menuButton.target = self.revealViewController()
            menuButton.action = "revealToggle:"
            self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())

Also, you want to set the next view's navigation controller not its view controller. Since you're not doing a normal segue, you'll lose the navigation controller.

Cole
  • 2,641
  • 1
  • 16
  • 34
0

You just need to add one more Navigation Controller between your sw_front Navigation Controller and View Controller and hide the visibility of navigation bar of first navigation controller.

saurabh dixit
  • 863
  • 6
  • 19