在我的应用程序中,它们是一个标签栏。总共5个标签,前三个选定的索引标签正常工作。其余两个选定的索引颜色在这些选项卡的“我正在使用弹出窗口”中未正确更改。并且操作正常,但未显示所选标签的颜色。
`类TabBarViewController:UITabBarController,UITabBarControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
selectedIndex = 2
self.delegate = self
}
func tabBarController(_ tabBarController: UITabBarController,shouldSelect viewController: UIViewController) -> Bool {
let nav = viewController as? UINavigationController
if (nav?.viewControllers[0] is StandByViewController) {
let stand = uistoryboard(name: "StandBy",bundle: nil)
let controller = stand.instantiateViewController(withIdentifier: "StandByViewController") as? StandByViewController
if let controller = controller
{
tabBarController.present(controller,animated: true)
}
return false
}
if (nav?.viewControllers[0] is BreakViewController) {
DispatchQueue.main.async {
let break = uistoryboard(name: "Break",bundle: nil)
let controller = break.instantiateViewController(withIdentifier: "BreakViewController") as? BreakViewController
if let controller = controller {
self.navigationController?.present(controller,animated: true)
}
}
return false
}
return true
}
} `