Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I delay splash launch screen programmatically in Swift Xcode iOS

Tags:

I have put an image in imageView in LaunchStoreyboard. How can I delay the time of image programmatically?

Here is the Launch Screen Guideline from Apple.

Here is code for Launch Screen View controller:

import UIKit class LaunshViewController: UIViewController {      override func viewDidLoad() {         super.viewDidLoad()         self.delay(0.4)     }      func delay(_ delay:Double, closure:@escaping ()->()) {         let when = DispatchTime.now() + delay         DispatchQueue.main.asyncAfter(deadline: when, execute: closure)     } } 
like image 788
Xcodian Solangi Avatar asked Apr 07 '17 10:04

Xcodian Solangi


People also ask

How do I customize launch screen in Swift?

There are a number of options for you to choose from. To configure the background color, set the key to Background color and value to LaunchScreenBackground , which is the color set created in the previous section. To include an image in the launch screen, click the + button to add another key. Set it to Image Name .


1 Answers

Put one line of code in AppDelegate class -

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {         Thread.sleep(forTimeInterval: 3.0)         // Override point for customization after application launch.         return true     } 
like image 190
Jack Avatar answered Sep 29 '22 15:09

Jack