【发布时间】:2020-07-28 15:47:09
【问题描述】:
我有一个导航控制器,它的根视图控制器是一个 logIn 视图控制器,当用户登录时,它调用 present(..) 来显示不同的屏幕,但我在显示器上有一些特别的东西。如图所示,它显示了两个屏幕之间的层。我无法消除这种行为。我的应用没有情节提要。
代码:
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
naviVC = UINavigationController()
naviVC?.viewControllers = [loginVc!]
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = naviVC
window?.makeKeyAndVisible()
window?.windowScene = windowScene
}
稍后当我在 loginVC 调用它时:
//nextVC is the next viewController here.
self.present(self.nextVC, animated: false, completion: nil)
如图所示输出: See the top, the green is the loginVC, the white is the nextVC
如何解决,让 nextVC 覆盖 LoginVC?
非常感谢任何帮助!
【问题讨论】:
标签: swift xcode uiviewcontroller uinavigationcontroller