views:

74

answers:

1

I have two views that need to be shown modally, one after the other. This doesn't work if we dismiss and show consecutively, like this:

[rootController dismissModalViewControllerAnimated: YES];
[rootController presentModalViewController: psvc animated: YES];

The second modal view simply doesn't show up.

I've seen a fix that was something like this:

[rootController dismissModalViewControllerAnimated: YES];
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
[self performSelector: @selector(seekModal) withObject: nil afterDelay: 0.5];
[[UIApplication sharedApplication] endIgnoringInteractionEvents];

The problem is that this won't work all the time (the delay needed is superior, sometimes).

Another possible fix would be to eliminate the animation:

[rootController dismissModalViewControllerAnimated: NO];
[rootController presentModalViewController: psvc animated: YES];

But I'd really like to keep the animation, to keep the feel that the first modal is out of the way. Any suggestions?

A: 

rootController can tell when the last of the modal view controllers on top of it has disappeared because it will receive a viewDidAppear:. Have you tried linking the presentModalViewController: of the subsequent view controller to that?

Tommy