我有一个带有两个UINavigationController
的UITabBarController
,当我从一个TabBarItem
切换到另一个时,先前选择的视图控制器应弹出到其根视图控制器。
Implement the UITabBarControllerDelegate tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController)
method like this:
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
if let navigationController = viewController as? UINavigationController{
navigationController.popToRootViewController(animated: false)
}
return true
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.