更改iPhone启动画面时间

时间:2011-09-22 07:48:54

标签: iphone ios xcode splash-screen

如何让启动画面停留更长时间,例如5秒钟?

4 个答案:

答案 0 :(得分:33)

在您的

中写下sleep(5.0)

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions方法。

答案 1 :(得分: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....
}

答案 2 :(得分:9)

您需要创建一个视图控制器来显示启动画面,如下所示。

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

答案 3 :(得分:2)

您正在谈论的启动画面可能是“default.png”文件。正如JustSid所提到的,这个文件并不是闪存屏幕,而是用作第一个屏幕快照,以改善有关应用程序加载时间的用户体验。检查人机界面指南

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

如果你想实现启动画面,你应该使用ie。 NSTimer和UIView组件。