views:

100

answers:

2

I present a UIViewController modally but would like to push another ViewController from the modal view. How can this be done as pushViewController does not work from a modal view. Thanks

+2  A: 

Use a UINavigationController as the view that you show modal. You can then push onto that controller.

Mike
Thanks, this does work, but the push is not being animated despite setting animated to YES
Run Loop
Post your code, it should work...
Mike
The reason it did not animate is because the navigation controller did not have a root viewcontroller. I have used a diff approach as below.
Run Loop
A: 

I have used a slightly different approach than Mike's suggestion. I create a navigation controller (NC) and init it with a root viewcontroller of the view controller (VC) I want to present modally. I then present the nc modally. I can then successfully push from the VC when needed.

Run Loop
Maybe I wasn't being clear, but that's the same approach I described. I assumed that you would be setting the root as you can't display a nav controller without anything on its stack. That would be the cause of why you weren't seeing any animation. The first view put on the nav controller's stack (the root view) is not animated.
Mike