While working on an iOS project last summer, I stumbled upon a very strange problem. Something that should have been very trivial in iOS views management, yet wasn't. The problem was this:
How to push a
UIViewControllerfrom within a modal view.
Or, as someone else asking about it put it:
I want to display a view with push transition inside a view which was displayed with modal transition.
After these files are included in the relevant
UINavigationController subclass, the modal controller should be created this way from within the root controller:
UINavigationController * modalNC = [[UINavigationController alloc] initWithRootViewController:rootVC]; // Very important to set the delegate here (see http://www.kickasslabs.com/2009/07/03/uinavigationcontroller-tricks/ ) modalNC.delegate = self; // blah blah blah ...
The most important thing here is to set the delegate to
self (it is the
controller that will still be visible under the modal view).
Then, when it is time to push, just call
[self pushViewControllerFromModal:newVC animated:YES];
from within the modal navigation controller.