ios 更改 iPhone 启动画面时间

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7511353/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 21:35:58  来源:igfitidea点击:

Change iPhone splash screen time

iphoneiosxcodesplash-screen

提问by iOS developer

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

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

回答by Dhara

Write sleep(5.0)in your

sleep(5.0)在你的

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptionsmethod.

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

回答by HelmiB

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

回答by iamsult

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

回答by Micha? Zygar

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

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

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

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.

如果你想实现闪屏,你应该使用 ie。NSTimer 和 UIView 组件。