How do you load a view on top of another view in t

2019-09-11 03:20发布

问题:

How do you load a view on top of another view in the iPad like in the wordpress app when it asks you to setup your blog. Can you show or post me some sample code. I have an NSUSerdefaults setup so it will display this on the first launch. I would like this view to look like this http://uplr.me/files/p45064.png

See how it has the shaddows and the view is darkened in the back. Thats what I am trying to do.

回答1:

I got it

AddViewController* firstLaunchController = [[AddViewController alloc] initWithNibName:nil bundle:nil];
UINavigationController *modalNavigationController = [[UINavigationController alloc] initWithRootViewController:firstLaunchController];
modalNavigationController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
modalNavigationController.modalPresentationStyle = UIModalPresentationFormSheet;
[detailViewController presentModalViewController:modalNavigationController animated:YES];
[firstLaunchController release];

was so simple

Thanks everyone



回答2:

The second view is loaded as a modal view of the first. See -[UIViewController presentModalViewController:animated:].

On the iPad, when you present a modal view, you get the darkening automatically.