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

后端 未结 6 1907
后悔当初
后悔当初 2021-01-31 19:01

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

Here is the Lau

6条回答
  •  自闭症患者
    2021-01-31 19:41

    Swift 4.x

    It is Not a good practice to put your application to sleep!

    Booting your App should be as fast as possible, so the Launch screen delay is something you do not want to use.

    But, instead of sleeping you can run a loop during which the receiver processes data from all attached input sources:

    This will prolong the launch-screen's visibility time.

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
    
        RunLoop.current.run(until: NSDate(timeIntervalSinceNow:1) as Date)
    
        return true
    }
    

提交回复
热议问题