How would I make the splash screen stay for longer, 5 seconds, for example?
Asked
Active
Viewed 3.4k times
7
-
6Its NOT a splash screen! Read the human interface guidelines. – JustSid Sep 22 '11 at 07:49
-
1what would you call it? and further more, how would you make it stay for 5 seconds, like the question asked? – iOS developer Sep 22 '11 at 07:52
-
3Having the "splash screen" on the screen for longer than it's needed makes the user feel your app is slow, something your users really don't want. – EmilioPelaez Sep 22 '11 at 07:54
-
Its a placeholder for the time the real interface is loading. And I would be glad that my App launches in a short amount of time instead of annoying the customer with a faked loading time. – JustSid Sep 22 '11 at 07:55
-
6Okay, maybe you don't think it would be good to make it seem slow, whatever. Just how would I do it if I wanted to? The question was not "Do you guys think it would make my app seem slow", it was "How do I make the splash screen stay longer?" – iOS developer Sep 22 '11 at 08:02
-
3Delaying application startup time deliberately will be frowned upon by Apple; unless your app is doing some genuine loading work, in which case it may be appropriate to add in a loading screen or similar, with a progress bar or spinner view. – Luke Sep 22 '11 at 08:11
-
You should only do this for games or other "entertainment" content where you need to show some credits or studio name on launch, and the user expects such clutter on launch. Still annoying, still against the HUIG, but common and widely accepted by the public. **Don't** do this for utility apps like e.g. Facebook. It will only make it look and feel as though it takes longer to launch (as others have pointed out). – Nicolas Miari Mar 09 '16 at 05:11
4 Answers
33
Write sleep(5.0)
in your
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
method.

Dhara
- 4,093
- 2
- 36
- 69
-
1
-
1Wouldn't this freeze your app code for 5 seconds? What if I want to fetch some cloud data while the 5 seconds is happening? – Van Du Tran Apr 12 '15 at 18:56
-
-
1I was under the impression that the operating system (iOS) will kill your app if it takes too long to launch. Have you tested this code? – Nicolas Miari Mar 09 '16 at 05:12
-
7
10
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
/*this will pause main thread for x interval seconds.
put on the top of application:didFinishLaunchingWithOptions, so it will not
proceed to show window until sleep interval is finished.*/
[NSThread sleepForTimeInterval:5]; //add 5 seconds longer.
//other code....
}

HelmiB
- 12,303
- 5
- 41
- 68
9
You need to create a view controller for displaying the splash screen as done below.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self generateRandomSplashScreen];
[self performSelector:@selector(removeSplashScreen) withObject:nil afterDelay:SPLASHSCREEN_DELAY];
[self otherViewControllerLoad]; // the other view controller
[self.window makeKeyAndVisible];
return YES;
}
-(void) generateRandomSplashScreen
{
splashScreenViewController = [[SplashScreenController alloc] initWithNibName:@"SplashScreenController" bundle:[NSBundle mainBundle]];
[self.window addSubview:self.splashScreenViewController.view];
}
-(void) removeSplashScreen
{
[splashScreenViewController.view removeFromSuperview];
self.window.rootViewController = self.tabBarController;
[splashScreenViewController release];
}
2
Probably the splash screen you are talking about is "default.png" file. As JustSid mentioned, this file is not intended to be splash screen, rather to be used as a first screen snapshot to improve user experience concerning application loading time. Check human interface guideline
If you want to implement splashscreen, you should use ie. NSTimer and UIView components.

Michał Zygar
- 4,052
- 1
- 23
- 36