I am drawing an application workflow where you have the main menu “Level 0”, which brings up the modal view “Level 1”, which calls up the other modal view “Level 0”.
I can get this job, no problem. And I can reject the entire stack using:
[[[self parentViewController] parentViewController] dismissModalViewControllerAnimated:YES];
in the modal view "Level 2".
My problem is that there is a navigation bar in the Level 2 modal view. I can’t remove the whole stack. The code above returns me only one level, so it acts just as if I did this:
[self dismissModalViewControllerAnimated:YES]
in the modal view "Level 2".
Summary: When a Level 1 modal view calls up a Level 2 modal view, use the following:
Level2 *level2 = [[[Level2 alloc] initWithNibName:@"Level2" bundle:nil] autorelease]; [self presentModalViewController:portalMainController animated:YES];
I can delete the entire stack and return to the main menu (Level 0). BUT, when "Level 1" calls up "Level 2" with the navigation bar, as shown below:
Level2 *level2 = [[[Level2 alloc] initWithNibName:@"Level2" bundle:nil] autorelease]; UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:level2]; [self presentModalViewController:navigationController animated:YES]; [navigationController release];
I can’t go back to Level 0, I’ll only go back to Level 1.
Any suggestions?