views:

45

answers:

2

Here is the situation, I have a login page as the initial rootView of a tab bar. Once the login process is done, the view is removed from the navigation controller, so you don't navigate back to it. I have places in the app where you can logout. The logout process works fine, but when I try to forward the user back to the initial login view (the one we removed) from inside the same tab bar item, I can't seem to reset the view controller stack to contain only the desired element. Is this a question of where I am changing the view? It just doesn't seem to remove the current view. I have tried alot of stuff, popto, popview, and many others, and nothing seems to work properly. Has anyone had to deal with this?

+1  A: 

Take a look at the View Controller Programming Guide and the various way to alter the navigation stack (push, pop, set, etc).

Laurent Etiemble
Yeah, like I said. I have tried pushing and poping. It works fine in test apps I set up. But I am not poping to a view controller in this case because the view I want to navigate to has been removed from the stack. If you have a specific spot in the guide you can point to, that would be great. But referencing it and assuming I am new at this just seems not nice.
Ollie
Sorry if you feel that. The link I gave points to a table that lists the different ways to alter the navigation stack: "pushViewController:animated:", "popViewControllerAnimated:" but also "setViewControllers:animated:". That means that you can replace the stack whenever you want, by whatever you want.
Laurent Etiemble
A: 

Look into making your login view controller into a modal view controller, which pops up when credentials need to be entered.

A modal view controller is perfect for view controllers that you don't need to keep around, but which can be needed at different points in your application usage "flow".

Laurent's link will explain to you what the different options are for a navigation stack, and Apple's document suggests contexts in which those different view controller types are useful. I highly recommend reading it.

Alex Reynolds