views:

515

answers:

2

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.

+2  A: 

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.

TechZen
I have tried using some code from Wordpress but cant get any of it to work. I am using this right now if (![[NSUserDefaults standardUserDefaults] boolForKey:@"isFirstLaunch"]) { CFirstLaunchViewController *nib = [[CFirstLaunchViewController alloc] initWithNibName:nil bundle:nil]; [window addSubview:nib.view]; nib.view.frame = CGRectMake(270, 288, 540, 576); [nib release]; }What do I need to do. Can you write up the code that I needI am fairly new to thisThanks
Magician Software
You dont' add as a subview. You use presentModalViewController: instead. Note, it is a view controller not a view. See the example code at http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/presentModalViewController:animated:
TechZen
+2  A: 

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

Magician Software
Thanks for sharing your code with us.
Tilo Mitra