发现当子控制器的数量大于1时,返回到根控制器 tabbar会消失!!!
解决方法:
修改自定义的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:我想说:.....