【发布时间】:2019-04-20 02:33:05
【问题描述】:
我正在开发一个项目,该项目有两个不同的 UITabBarControllers 来表示应用程序的两种不同状态。我可以在用户登录后设置第一个 UITabBarController 并在按下按钮时显示第二个。但是,在第二个 UITabBarController 中导航时出现了奇怪的行为。
这就是我设置主标签栏的方式。
let mainTabBar = MainTabBarController()
let mainMode = UINavigationController(rootViewController: mainTabBar)
UIApplication.shared.keyWindow?.rootViewController = mainMode
我使用相同的方法导航到第二个标签栏。
let secondaryTabBar = SecondaryTabBarController()
let hiddenMode = UINavigationController(rootViewController: secondaryTabBar)
UIApplication.shared.keyWindow?.rootViewController = hiddenMode
但是,当使用辅助 UITabBarController 时,我在导航到 AVCaptureSession 时会看到来自主 UITabBarController 的视图。更具体地说,我在捕获会话的模态表示下从 mainTabBar 看到了最后一个视图(从中设置了 secondaryTabBar)。问题来了:
let captureSession = CameraViewController()
navigationController?.present(captureSession, animated: true, completion: nil)
【问题讨论】:
标签: swift uinavigationcontroller uikit uitabbarcontroller