![](/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.