简体   繁体   中英

iPhone 3.0 SDK: stacked presentModalViewController calls or in series?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM