给UINavigationController建立一个BaseNavigationController,然后在BaseNavigationController重写一下以下这个方法,在你创建导航的那个地方将UINavigationController改成BaseNavigationController,只要用导航栏push的页面,tabbacController都会自动隐藏。
override func pushViewController(_ viewController:UIViewController, animated:Bool) {
if childViewControllers.count>0{
viewController.hidesBottomBarWhenPushed=true
}
super.pushViewController(viewController, animated: animated)
}
网友评论