iPhone 3.0 SDK Splash Screen
11/01/2010
This is a taste of what I’m working on at the moment, Objective-C and iPhone app development. This is some sample code I use to display a splash screen.
Step 1:
Put a Default.png file in your project resources, this will be displayed whilst the app is loading.
Step 2:
in your AppDelegate.h @interface put:
UIImageView *splashView;<br />
Step 3:
In your AppDelegate.m put the following code in applicationDidFinishLaunching and underneath
[window makeKeyAndVisible];
<br />
splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)];<br />
splashView.image = [UIImage imageNamed:@"Default.png"];<br />
[window addSubview:splashView];<br />
[window bringSubviewToFront:splashView];<br />
[UIView beginAnimations:nil context:nil];<br />
[UIView setAnimationDuration:1.1];<br />
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:window cache:YES];<br />
[UIView setAnimationDelegate:self];<br />
[UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)];<br />
splashView.alpha = 0.0;<br />
splashView.frame = CGRectMake(-60, -60, 440, 600);<br />
[UIView commitAnimations];<br />
Thats it! Load it up and hope it all works.
via iphonedevsdk.com / stackoverflow.com