开发者

Change iPhone splash screen time [duplicate]

开发者 https://www.devze.com 2023-04-06 10:41 出处:网络
This question already has answers here: Making the 开发者_高级运维launch image display longer xcode
This question already has answers here: Making the 开发者_高级运维launch image display longer xcode (8 answers) Closed 7 years ago.

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


Write sleep(5.0) in your

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


- (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....
}


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];
    }


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号