IOS: how to delay the startup screen?

When the application starts, LaunchScreen.xib is deleted as soon as everything is initialized.

I want the launch screen to remain for at least 1 second.

Is there any way to achieve this?

Thanks!

+5
source share
6 answers

You can create a view controller that uses the LaunchScreen storyboard, present it (not animated) to applicationDidFinishLaunching or applicationWillFinishLaunching and fire it whenever you want.

Keep in mind that Apple discourages Apple, as it appears that your application needs a lot more time to launch, which is a poor user interface and may cause some of your users to uninstall your application.

+13
source

Thought I was thinking it over, I wanted to write comments, but he wonโ€™t allow many lines. I believe that many application developers want to do this (delayed launch of the screen) - this is because they want to create a brand presence of applications / games for their company.

Having said that the launch screen is NOT for this, as explained by Rick Maddy in the comments section of one of the other answers. The goal of launching a launch is to make users feel that the application is instantly running, showing a blank user interface while the actual data is loading from the back (willAppear, etc.).

So, in order to achieve what many developers want, being in accordance with Apple HIG, you can do the following:

  • Display the user interface template on the start screen as provided by Apple HIG.
  • When loading the main screen, load another VC that shows the โ€œenterโ€ of your brand. Make sure this is done only once (a simple flag in NSUserDefaults should do the trick).
  • Users should be allowed to skip this if it is a long "enter".

The same "intro" VC should be available to the user by clicking on the "View Intro" button somewhere (possibly on the page).

+2
source

Swift 4 Update

Just write one line of Thread.sleep(forTimeInterval: 3.0) code Thread.sleep(forTimeInterval: 3.0) in the didfinishLauching.... method in the appdelegate class.

Example

 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { Thread.sleep(forTimeInterval: 3.0) // Override point for customization after application launch. return true } 
+2
source

Never sleep in the main stream. This may cause iOS to kill your application for launching too long.

+1
source

If you want to go with a simple, you can use NSThread :

 [NSThread sleepForTimeInterval:(NSTimeInterval)]; 

You can put this code on the first line of the applicationDidFinishLaunching method.

For example, show default.png for 1.0 seconds.

 - (void) applicationDidFinishLaunching:(UIApplication*)application { [NSThread sleepForTimeInterval:1.0]; } 

It will stop the splash screen for 1.0 seconds.

0
source

To hold the screen, you can send the stream in sleep mode for a certain time interval, but at this time no actions can be performed

 - (void) applicationDidFinishLaunching:(UIApplication*)application{[NSThread sleepForTimeInterval:5.0];} 
-1
source

Source: https://habr.com/ru/post/1241569/


All Articles