View Full Version : Skip a Navigation View Controller then come Back to it

Oct 28, 2009, 02:53 PM
In my design, there are three view controllers in a regular sequence. Yet there is a scenario where I need to skip the second view controller, but then come back to it when the back button is pressed. I tried to push the third view controller with an if statement in the viewDidLoad of the second viewController. I then tried many scenarios in the ViewDidLoad, ViewDidAppear, etc. Each time, the navigation bar at the top got messed up: when I pushed to the third view controller, the nav title and buttons for the second were there, when I went back to the second, the nav title and buttons for the third were there, etc. Each time, the views showed up as expectedl, but just the top bar and buttons were messed up. I thought of calling the third view controller directly from the first, but then I could not get the back button to have it go back to the second. I'd really appreciate some advice on this.

Oct 28, 2009, 02:58 PM
I once had a design like this, but I instead went to a different design using a modal table view. Are you really sure you want to want to have it going backwards like that? It might be good to reread the apple design docs.

Oct 28, 2009, 03:07 PM
Thanks skunkworker. Not a bad idea, I'm just not sure how I'd do it. The third view controller is a selection view controller and the second is my detail view controller. When I add a new detail item, the only missing piece that I have is the piece that needs to be selected, so I thought I could just skip to that, select what I need, and then some back to the detail view to add any supplementary information, if necessary. So, I guess I can pop up a modal to select, then send that info back to the detail view controller as delegate? I really didn't want a modal here and don't think it would have as good as a feel, but I want to be true to Apple's design. Please advise further if you can. Thanks.

Oct 28, 2009, 03:09 PM
Also, more pertinent info: the first view is not a root view controller as a list of the detail items, but a detail view controller of its own, with a list of the detail items as a section. That is why I think the modal might be awkward.

Oct 28, 2009, 03:53 PM
I would rework the flow a little bit.
For example my app
instead of having 3 different windows for selecting one piece of data, then another and then finally showing the results.
I now have it show the results page and prompt to bring up a modal view controller with the settings in a table.

Look at other applications and think about hierarchal displays of information.
instead of this:

View 1
Selection View
View 3

where they are all on the same level

View 1
- Selection View
View 3

so that the selection view is a subset of view 1