I have an application which its rootview is a menu to 4 tableviews that the user uses to set up a search query by selecting a cell that loads another subview, so the basic structure looks like this
Root View
- Parent View (search view)
--Sub View (user selects variables here to fill search parameters of the parent view
But one of the Parent View search parameters requiers another sub view to be pushed onto the navigation stack so it would look like
Root View
- Parent View (search view)
--Sub View (user selects variables here to fill search parameters of the parent view
---Sub View (related values to the previous subview i.e. Model / sub model)
I would like to know if there is a way to pop back to the Parent View from this Sub View.. I know you can pop a single view or pop back to rootview but on this occasion I want to pop two subviews... is this possible?
You can add a category to UINavigationController to allow multiple controllers to be popped at once.
UINavigationController+VariablePop.h
UINavigationController+VariablePop.m #import "UINavigationController+VariablePop.h"
And then from the view controller you can:
UINavigationViewController
popToViewController:animated:
Pops view controllers until the specified view controller is at the top of the navigation stack.