xcode 6 - 更改默认启动屏幕显示时间
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27120336/
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
xcode 6 - change default launch screen display time
提问by Ketan
In a new Xcode 6 project, a default LaunchScreen.xib
file is created that is displayed for a brief time when the app starts. How can I alter the time of the display e.g. display it for 5 seconds?
在新的 Xcode 6 项目中,LaunchScreen.xib
会创建一个默认文件,该文件会在应用程序启动时显示一小段时间。如何更改显示时间,例如显示 5 秒?
回答by RckLN
You can also use NSThread
:
您还可以使用NSThread
:
[NSThread sleepForTimeInterval:(NSTimeInterval)];
You can put this code in to first line of applicationDidFinishLaunching
method.
您可以将此代码放入applicationDidFinishLaunching
方法的第一行。
For example, display screen for 4 seconds.
例如,显示屏幕 4 秒。
File: AppDelegate.m
文件: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....
}