0
votes

I am presenting a navigation controller with a view controller initialized as its root using presentModalViewController. However, when I push another view controller onto this new navigation stack, the back button needs to be pushed twice to return to the original view presented modally. Any idea why this would occur? Is it possible that the new view controller is being pushed onto the original navigation controller and then the navigation controller in the modal view controller as well?

My code in the original navigation controller:

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:addViewController];  
[self.navigationController presentModalViewController:navController animated:YES];
[addViewController release];
[navController release];

And then my code inside the modal view:

PriorityViewController *priorityView = [[PriorityViewController alloc] initWithNibName:@"PriorityView" bundle:nil];
priorityView.taskInfo = self.taskInfo;
priorityView.isAdding = YES;
[self.navigationController pushViewController:priorityView animated:YES];
[priorityView release];
2

2 Answers

0
votes

You have two navigation stacks - you are presenting a navigation controller modally.

Just use one, like this:

 [self.navigationController presentModalViewController:addViewController animated:YES];
 [addViewController release];
0
votes

I figured out my issue. I was handling the view controllers, and the navigation controller just fine. But was using a table view to push the new controllers onto the navigation controller stack. And the switch statement handling the row selection in my table view was missing a break statement, so two cases were being called instead of just one meant for that row, if that makes any sense.