views:

1184

answers:

2

Here's the scenario: if this is a user's first time logging into my web service, I present a modal login view. Upon success, the user may have multiple items in his/her account and must choose one of them before he/she can proceed with the rest of the app.

I want to put up another modal view with a picker so the user can make the choice.

All the examples I've seen of multiple modals presented are canned ones (like the email composer modal, with the people picker modal coming up over it), which is of no use because the code isn't available.

When I try putting up the login modal, then dismissing it, then presenting the picker, I get a recursion somewhere with a selector being sent to subviews being sent to subviews being sent to ....

Can anyone point me to some sample code?

I'm keeping a reference to the login view, so I figured I'd just pose the stack (well, two) modal views, then dismiss the login modal and they'd all go away (like the documentation says), but I can't seem to get this going.

Thanks in advance.

A: 

I have found that I could do this, but had to eliminate animation on the first dismiss, iff I was using animation on the 2nd presentModalViewController

ContactsViewController* controller = [[ContactsViewController alloc] ...
UINavigationController* navigationController = [[UINavigationController alloc] initWithRootViewController:controller];

[self.navigationController presentModalViewController:navigationController animated:YES];
[controller release], controller = nil;

and then in my delegate method that is being called from the initial modal view

[self.navigationController dismissModalViewControllerAnimated:NO]; // dismiss without animation
[self.navigationController presentModalViewController:anotherViewController animated:YES];

This behavior was observed on OS 3.0.1.

Jeff Schilling
A: 

Thank you for sharing!. I was quite stumped with this exact issue. Works like a charm.

rydgaze