tags:

views:

273

answers:

1

I am creating a Navigation based iPhone application.

In that I have called a UiViewController using presentModalViewController. After that, the ViewController becomes visible. From that ViewController I need to call another ViewController using the sample presentModalViewController. Is this possible or not?

+1  A: 

What do you mean by "call another uiviewcontroller"? (It really helps if you can be more detailed in your question.) If you mean, "slide in another view controller", then:

MyNewViewController *myNewViewController = [[MyNewViewController alloc] initWithNibName:@"MyNewViewController" bundle:nil];
[navigationController pushViewController:myNewViewController animated:YES];
[myNewViewController release];

...where:

  • MyNewViewController is the new view controller class that you want to slide in (the above code assumes you have an XIB file for the view controller class).
  • navigationController points to the current navigation controller. You'll have to replace it with something like [self navigationController], depending where you are in the view hierarchy.
Steve Harrison