I\'m quite a newbie in Cocoa, Objective-C and iOS development.
I\'d like to implement a View that is just a splash screen and only last for a short time before routi
You can easily implement your view on top of the main view but in your appDelegate
. For example, if you want a splash image that fades out to the main view: (or a default image that seems to fade out: just put the same image on the splash screen and the default screen).
This gives you also the right orientation as long as it is the main view's.
Just add it in your application:(UIApplication *)application didFinishLaunchingWithOptions:
method:
UIImageView*imageView=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"your_default_image_or_another.png"]];
[[firstViewController view] addSubview:imageView];
[[firstViewController view] bringSubviewToFront:imageView];
// as usual
[self.window makeKeyAndVisible];
//now fade out splash image
[UIView transitionWithView:self.window duration:1.0f options:UIViewAnimationOptionTransitionNone animations:^(void){imageView.alpha=0.0f;} completion:^(BOOL finished){[imageView removeFromSuperview];}];
The other answers are good but I'd like to add that for iPhone apps your Default.png should be 320x480 and for retina displays you should add Default@2x.png 640x960.
To add splash screen first add that image in your project and then add the following code to your AppDelegate
method in the didFinishLaunching
method
[NSThread SleepForTimeInterval:(Time interval)];
As @Espresso posted link, I just wants to explain it to you.
If you just place an image named Default.png inside your project then it will be used for splash screen. However you can use different image name by explicitly specifying it in plist file.
I know I'm giving answer to almost one year old question, but it may help some one else-
I've just discovered that you can do this in XCode4! Which makes this a rather simple process now.
In XCode 4, you can click on the Project Name (the parent in the hierarchy on the left).
Then in the Summary tab, under iPhone and iPad you will be able to select the Launch images for each form the file system.