dragon
dragon

Reputation:

NavigationController Problem

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...

Upvotes: 0

Views: 653

Answers (3)

Louis Gerbarg
Louis Gerbarg

Reputation: 43452

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.

Upvotes: 1

dragon
dragon

Reputation:

In presentModalViewController

Upvotes: 0

Amagrammer
Amagrammer

Reputation: 6373

Do you mean "push" as in pushViewController, or as in presentModalViewController?

Upvotes: 0

Related Questions