![](/img/trans.png)
[英]How can I change the initial ViewController in LaunchScreen with Swift?
[英]how can I set initial viewController that can push after instantiate in swift 5
使用此代码后,我无法从初始 viewController 推送
self.window = UIWindow(框架:UIScreen.main.bounds)
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let initialViewController = storyboard.instantiateViewController(withIdentifier: Identifier)
self.window?.rootViewController = initialViewController
self.window?.makeKeyAndVisible()
您必须在 UINavigationController 中嵌入 UIViewController。 试试这个:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let initialViewController = storyboard.instantiateViewController(withIdentifier: Identifier)
let navController = UINavigationController(rootViewController: initialViewController)
self.window?.rootViewController = navController
self.window?.makeKeyAndVisible()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.