【问题标题】:Customize Time For Launch Screen [duplicate]自定义启动屏幕的时间[重复]
【发布时间】:2016-10-17 02:12:43
【问题描述】:

我正在使用 Xcode 7.2 和 swift 2。我在启动故事板中添加了一个启动屏幕。但是,当我运行该应用程序时,启动屏幕会很快消失。有什么方法可以自定义时间吗?

【问题讨论】:

    标签: xcode swift launch


    【解决方案1】:

    你可以创建一个全新的 ViewController 来显示一个启动屏幕,例如:

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
        self.generateRandomSplashScreen()
        self.performSelector("removeSplashScreen", withObject: nil, afterDelay: <Your delay in seconds>)
        self.otherViewControllerLoad()
        // the other view controller
        self.window.makeKeyAndVisible()
        return true
    }
    
    func generateRandomSplashScreen() {
        splashScreenViewController = SplashScreenController(nibName: "SplashScreenController", bundle: NSBundle.mainBundle())
        self.window.addSubview(self.splashScreenViewController.view!)
    }
    
    func removeSplashScreen() {
        splashScreenViewController.view!.removeFromSuperview()
        self.window.rootViewController = self.tabBarController
    
    }
    

    【讨论】:

      猜你喜欢
      • 2017-05-27
      • 1970-01-01
      • 1970-01-01
      • 2015-12-30
      • 2015-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多