swift - 从 Appdelegate 导航时标签栏和导航栏消失
问题描述
我使用故事板。当我尝试从 AppDelegate 导航到另一个视图时,该视图中的选项卡栏和导航栏消失了
这是代码
//Some conditions here
let storyBoard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let homeView = storyBoard.instantiateViewController(withIdentifier: "HomeViewController")
self.window?.rootViewController?.present(homeView, animated: true, completion: nil)
解决方案
let storyBoard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let homeView = storyBoard.instantiateViewController(withIdentifier: "HomeViewController")
self.window?.rootViewController = UINavigationController(rootViewController: homeView)
使用这个代码它应该适合你