I have a situation where I want to open one modal controller from the other. But when the user closes either, they should go back to the parent controller of both modal controllers.
So I have the parent controller in charge of this. The method on the parent does something similar to the code below when the user clicks a button on the first modal controller.
[self.navigationController dismissModalViewController:YES];
SecondModalViewController *c = [[SecondModalViewController alloc] init];
[self.navigationController presentModalViewController:c animated:YES];
[c release];
The only thing that happens is the first view closes, but I don’t see the second view open. Is it possible to close a modal ViewController and open a second one in the same method? If so, how?
I do that same thing all the time without a problem, though mine have
animated:NO… I’m guessing your issue is because you haveanimated:YESon both. What effect are you looking for exactly? Do you want to see one get animated away, and then the other get animated in? If so, you need to execute the presentModalViewController with a delay.Otherwise, you should just be able to present the second modal view controller without closing the first one at all. When you call dismissModalViewController; it should dismiss both.