views:

124

answers:

2

Hi I have a modalViewController that I am popping up using

[self presentModalViewController:myController animated:YES];

I have an event occurring within myController which I would like to result in another controller being pushed onto the navigation stack ON TOP OF myController (which again has been presented modally). How can I do this?

I have tried the following from within myController:

UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:self];
  NewController* n = [[NewController alloc] init];
  [navController pushViewController:n animated:YES];
  [n release];

This does not work however....

+1  A: 

If i understand right you want to display new navigation stack on top of modal view. If it is right I think it won't be possible. Modal view is a top one. Even if you'll push new ViewController to the "parent" navigation stack - it won't be available until you'll quite from your modal view.

OgreSwamp
This is exactly what I want - to display a new nav stack on top of a modal view.However, I do think it is possible. If you look at the facebook app, goto the homescreen, tap on the notification bar at the bottom, and then for any of the notifications tap any of the links which will push a nav stack on top of the notifications modal view. Any ideas how this was done?
aloo
Yes, I think I know how it was done. They don't push navigation stack on top. They IMHO create UINavigationViewController, push notification view in it and show it as a modal view. Hope I explained clearly.
OgreSwamp
+2  A: 

First create your second modalViewController

NewController* new = [[NewController alloc] init];

then create navigaitonController like this

UINavigationController* navigationController = [[UINavigationController alloc] initWithRootViewController: new];
navigationController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

then present your navigationController as modalview controller

[self presentModalViewController:navigationController animated:YES];
[navigationController release];

Here you go. Hope it helps.

EEE
THis worked great - thanks!
aloo