xcode 6 - 更改默认启动屏幕显示时间

时间:2014-11-25 06:45:22

标签: xcode xcode6 delay splash-screen launch-screen

在新的Xcode 6项目中,创建了一个默认的LaunchScreen.xib文件,该文件会在应用程序启动时显示一段时间。如何更改显示的时间,例如显示它5秒钟?

1 个答案:

答案 0 :(得分:10)

您还可以使用NSThread

 [NSThread sleepForTimeInterval:(NSTimeInterval)];

您可以将此代码放入applicationDidFinishLaunching方法的第一行。

例如,显示屏幕为4秒。

文件:AppDelegate.m

- (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:4]; //add 4 seconds longer.
   //other code....
}