My screen flow is as follow
Login -> Registration -> CarDetails
All 3 above screens are in navigation-controller, but users are not allowed to go back from Car-Details to Registration. To achieve it, I've
override func viewWillAppear(animated: Bool)
{
self.navigationItem.setHidesBackButton(true, animated:true);
}
in CarDetails view controller. So it hides the back button which automatically gets created if controller is in navigation-controller.
So far it is good.
After providing all detail user lands on Home Screen where I've slide out menu. From menu user can goto to CarDetail Screen as well (to update). That time instead of backButton I need slide-out menu button as left bar button. So I've created it using storyboard.
The problem is that it is getting displayed after Registration view as well. I need conditional show/hide functionality for it in Car-Details View.
I've hook for it as well, as following
override func viewDidLoad()
{
super.viewDidLoad()
if menuButtonVisibility
{
if self.revealViewController() != nil
{
menuButton.target = self.revealViewController()
menuButton.action = "revealToggle:"
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
}
}
else
{
}
menuButtonVisibility=true
}
I only need the line to put in else block.