If I created a UINavigationController programmatically, how would I exit it?
Exit, as in deallocate it from memory.
For example, let's say my app starts off with a full-screen main menu with some buttons,
and then when I click on a button, I create a navigation controller with its own view.
How would I then exit the navigation controller, and go back to the main menu?
It's not clear what you mean. The tile mentions navigation controller but then you talk about navigation bar. Those aren't the same. How you dispose of it depends on how you create and present it. What you allocate you must release, if you present a modal view controller you need to dismiss it. If you add it as a subview you need to remove it from its superview... etc.
It's not clear what you mean. The tile mentions navigation controller but then you talk about navigation bar. Those aren't the same. How you dispose of it depends on how you create and present it. What you allocate you must release, if you present a modal view controller you need to dismiss it. If you add it as a subview you need to remove it from its superview... etc.
I corrected it.
This is a navigation controller.
It's not a modal view controller, there's nothing to dismiss.
It's not a view, there's nothing to remove from a superview.
...then that's all you need to do (other than properly releasing both the RooViewController and navigation controller)
Thanks for the help!
If I set self.window.rootViewController to nil or to another controller, should my root view's
viewDidUnload method get called? Because I added a NSlog in that method, and it doesn't get called.
I'm just trying to find some indication that the rootViewController has been deallocated.
viewDidUnload is not part of the teardown routine, so no. Put a log in dealloc. Or use Instruments.
I added these lines, but I think they're overkill and not needed. Since I'm already at the rootView when all of this happens.
viewDidUnload still doesn't get called, but viewDidDisappear does get called.
// Last line
self.window.rootViewController = nil;
I think the last line is all I need.
And exiting this way does create one small problem. The exit happens very fast. Too fast. It's not animated.
So, the exit either needs to be animated, or some kind of transition needs to happen.