ios 增加 xcode 上的启动图像时间

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7137089/
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:12:18  来源:igfitidea点击:

increase launch image time on xcode

iphoneobjective-ciosxcodeipad

提问by Ruth85

for iOS devices, after set a custom launch time image, when tested on simulator it remains about 4s but when tested on iphone it is hide after less than 1s! Assumed that depends on processor but how to modify that visualization time?? Thanks.

对于 iOS 设备,设置自定义启动时间图像后,在模拟器上测试时它保持大约 4 秒,但在 iphone 上测试时,它在不到 1 秒后隐藏!假设这取决于处理器,但如何修改可视化时间??谢谢。

回答by Parth Bhatt

Better option would be to put a sleep of 5 seconds in your appDidFinishLaunching:method.

更好的选择是在您的appDidFinishLaunching:方法中睡眠 5 秒。

Statement at the start of your appDidFinishLaunching:method.

appDidFinishLaunching:方法开始时的语句。

sleep(5);

Hope this helps you.

希望这对你有帮助。

Note:- You may want to increase the time from 5 seconds to whatever time that is suitable for you. Thanks

注意:- 您可能希望将时间从 5 秒增加到适合您的任何时间。谢谢

EDIT:You may need to include #import <unistd.h>statement.

编辑:您可能需要包含#import <unistd.h>声明。

回答by shein

You can't actually change of the loading time itself - that's decided by the operating system and how it takes to load. BUT - you can make it feel like it takes longer by simply putting a UIImageViewwith your image on top of your main window application and removing it using an NSTimer- you can even use nicer animations to make it disappear like make it fade out.

您实际上无法更改加载时间本身 - 这取决于操作系统及其加载方式。但是 - 您可以通过简单地将UIImageView带有图像的图像放在主窗口应用程序顶部并使用 an 删除它来让它感觉需要更长的时间NSTimer- 您甚至可以使用更好的动画让它消失,就像让它淡出一样。

回答by Chuck

We can also increase the durationtime of App Launch Image by implement applicationShouldLaunchas below,

我们还可以duration通过applicationShouldLaunch如下实现来增加App Launch Image的时间,

#import "MSTRMobileAppDelegate.h

@implementation MSTRMobileAppDelegate (Extension)

- (BOOL)applicationShouldLaunch:(UIApplication *)application errorDescription:(NSString**)errorString
{   
    sleep(10);

    return TRUE;
}

@end`

回答by Bori Oludemi

Add the sleep function to your this method below in your delegate class.
NOTE: the name of the method is NOT the same as suggested in the answers above.

在您的委托类中将 sleep 函数添加到下面的 this 方法中。
注意:该方法的名称与上述答案中建议的名称不同。

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions  
    {

    sleep(3); //PUT THE SLEEP HERE AND IT WILL HOLD YOUR LAUNCH IMAGE FOR HOWEVER SECONDS YOU "SLEEP"

    // Override point for customization after application launch.

    return YES;

    }

This worked for me. This post is intended for future seekers to this problem not that I'm trying to answer a question that was asked 2 years ago

这对我有用。这篇文章是为未来寻求这个问题的人准备的,而不是我试图回答 2 年前提出的问题