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