[在AppDelegate中推送时未显示新的ViewController

问题描述 投票:1回答:1

这是我的代码,将在Swift 5中显示来自应用程序委托的ViewController,我所做的一切与其他人相同,但是启动应用程序时不会显示新的ViewController。

        let mainStoryboardIpad : UIStoryboard = UIStoryboard(name: "Main", bundle: Bundle.main)
        let welcome  = mainStoryboardIpad.instantiateViewController(withIdentifier: "Welcome") as! WelcomeScreen

        self.window = UIWindow(frame: UIScreen.main.bounds)
        self.window?.rootViewController = welcome
        self.window?.makeKeyAndVisible()

ios swift appdelegate swift5
1个回答
0
投票

放入

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

        let mainStoryboardIpad : UIStoryboard = UIStoryboard(name: "Main", bundle: Bundle.main)
        let welcome  = mainStoryboardIpad.instantiateViewController(withIdentifier: "Welcome") as! WelcomeScreen
        self.window = UIWindow(frame: UIScreen.main.bounds)
        self.window?.rootViewController = welcome
        self.window?.makeKeyAndVisible()

        return true 
}
© www.soinside.com 2019 - 2024. All rights reserved.