發(fā)現(xiàn)當(dāng)子控制器的數(shù)量大于1時妙同,返回到根控制器 tabbar會消失A逄蕖6啊!
解決方法:
修改自定義的NavigationController中的 pushViewController(_ viewController: UIViewController, animated: Bool) 方法
override func pushViewController(_ viewController: UIViewController, animated: Bool) {
if children.count > 0 {
viewController.hidesBottomBarWhenPushed = true
// 解決push多個控制器后液样,popToRootViewController TabBar消失的問題
if children.count > 1 {
viewController.hidesBottomBarWhenPushed = false
}
}
super.pushViewController(viewController, animated: true)
}
End:我想說:.....