如何保持启动画面直到应用程序委托中的进程结束?

How to hold splashscreen until process in app delegate is over?

我在 app delegate 中放置了一些 func,我希望启动画面等到 appdelegate 完成它的 func。现在,我的应用程序立即 运行 将初始视图控制器函数和应用程序委托函数组合在一起。

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.

    let email = NSUserDefaults.standardUserDefaults().stringForKey("userEmail")
    if let email = email {
       reLogin()
    }else{
        buildNavigationDrawer()
    }// I want this execute first and run the initial view controller's after

    return true
}

如何做到这一点?或者这是关闭初始视图控制器的方法?

在您的应用委托完成处理之前,无法将初始屏幕保留在屏幕上 didFinishLaunchingWithOptoins。但是,您可以让您的应用程序的第一个视图与启动图像匹配。然后,当您准备好显示您的内容时,您可以关闭第一个视图。

您无法将启动画面保持在原生屏幕上超过预期的时间。您可以在初始屏幕之后显示类似的视图控制器,但前提是您管理大量数据并且需要加载屏幕。 Apple App Store 指南也禁止按住启动画面。