Iphone – NavigationController Problem

iphone

In navigationcontroller application , i used

ViewController *modalViewController=[[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];

[[self navigationController]presentModalViewController:modalViewController animated:NO];

[modalViewController release];

above code will load an anotherviewcontroller….
I want to push one moreviewcontroller from this viewcontroller(ViewController)…

Can any one help me?

Thanks in advance…

Best Answer

If you actually want to push view controllers in the modal view then the modal view needs to be a UINavigationController. So you would do something like this:

ViewController *modalViewController=[[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];
UINavigationController *modalNavController = [[UINavigationController alloc] initWithRootViewController:modalViewController];
[modalViewController release];

[self.navigationController presentModalViewController:modalNavController animated:NO];
[modalNavController release];

I generally wouldn't recommend doing it because it is confusing to the user, but in some cases it makes sense.

Related Topic