7

How would I make the splash screen stay for longer, 5 seconds, for example?

iOS developer
  • 317
  • 2
  • 10
  • 20
  • 6
    Its NOT a splash screen! Read the human interface guidelines. – JustSid Sep 22 '11 at 07:49
  • 1
    what 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
  • 3
    Having 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
  • 6
    Okay, 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
  • 3
    Delaying 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 Answers4

33

Write sleep(5.0) in your

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method.

Dhara
  • 4,093
  • 2
  • 36
  • 69
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];
    }
Luke
  • 11,426
  • 43
  • 60
  • 69
iamsult
  • 1,581
  • 1
  • 15
  • 21
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

http://developer.apple.com/library/ios/documentation/userexperience/conceptual/mobilehig/IconsImages/IconsImages.html#//apple_ref/doc/uid/TP40006556-CH14-SW5

If you want to implement splashscreen, you should use ie. NSTimer and UIView components.

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