为什么在安装应用程序时启动 Paper-Onboarding 时导航控制器会消失?
Why does Navigation Controller disappear when Paper-Onboarding is launched upon app installation?
我有这个应用程序需要 OnboardingVC
为用户提供教程。 OnboardingVC
在安装应用程序时启动。我在 appdelegate
中添加了我的代码,其中包含以下代码:
`if !UserDefaults.standard.bool(forKey: "didSee") {
UserDefaults.standard.set(true, forKey: "didSee")
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let mainController = storyboard.instantiateViewController(withIdentifier: "OnBoardingVC")
self.window?.rootViewController = mainController
self.window?.makeKeyAndVisible()
}`
当我点击 OnboardingVC
中的 Skip
和 Get Started
按钮进入 MainViewController
时,Navigation Bar
和其他按钮一样消失了ViewControllers
。但是,当我点击 MainViewController
内的 Login
按钮时,Navigation Bar
工作顺利。下面是我的故事板的截图
希望我确实以您能理解我的问题的方式进行了解释。请帮我。谢谢
使用这样的东西
因为您的应用始终以导航控制器开始
if !UserDefaults.standard.bool(forKey: "didSee") {
UserDefaults.standard.set(true, forKey: "didSee")
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let mainController = storyboard.instantiateViewController(withIdentifier: "OnBoardingVC")
let nav1 = UINavigationController()
nav1.viewControllers = [mainController] //Set on board vc as rootviewcontroller
self.window?.rootViewController = nav1
self.window?.makeKeyAndVisible()
}`
我有这个应用程序需要 OnboardingVC
为用户提供教程。 OnboardingVC
在安装应用程序时启动。我在 appdelegate
中添加了我的代码,其中包含以下代码:
`if !UserDefaults.standard.bool(forKey: "didSee") {
UserDefaults.standard.set(true, forKey: "didSee")
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let mainController = storyboard.instantiateViewController(withIdentifier: "OnBoardingVC")
self.window?.rootViewController = mainController
self.window?.makeKeyAndVisible()
}`
当我点击 OnboardingVC
中的 Skip
和 Get Started
按钮进入 MainViewController
时,Navigation Bar
和其他按钮一样消失了ViewControllers
。但是,当我点击 MainViewController
内的 Login
按钮时,Navigation Bar
工作顺利。下面是我的故事板的截图
希望我确实以您能理解我的问题的方式进行了解释。请帮我。谢谢
使用这样的东西 因为您的应用始终以导航控制器开始
if !UserDefaults.standard.bool(forKey: "didSee") {
UserDefaults.standard.set(true, forKey: "didSee")
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let mainController = storyboard.instantiateViewController(withIdentifier: "OnBoardingVC")
let nav1 = UINavigationController()
nav1.viewControllers = [mainController] //Set on board vc as rootviewcontroller
self.window?.rootViewController = nav1
self.window?.makeKeyAndVisible()
}`