Say that you have some ViewControllers like:
A --> B --> C --> X --> D
Where X
is some sort of perpetual menu that can be opened from everywhere. All of those are plugged to a NavigationController
, so for going back I would do something like:
func leftNavButtonClick(sender: UIButton) {
navigationController?.popViewControllerAnimated(true)
}
However if I do that from D
, I want to go back to C
, not X
. I tried dismissing the menu before opening the next ViewController
but that doesn't seem to work very well.
Any ideas?
You can use the view controller stack to find your VC and pop to it