基于UITabBarController的底部工具栏,隐藏底部工具栏的方法是:
viewController.hidesBottomBarWhenPushed = true
这个方法只能在第二UIViewController中使用,不能在UINavigationController的rootController使用,否则会导致回到第一个UIViewController中底部工具栏不见了的情况
重写UINavigationCotroller 的 func pushViewController(_ viewController: UIViewController, animated: Bool)方法来隐藏工具栏
class BANavigationController: UINavigationController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func pushViewController(_ viewController: UIViewController, animated: Bool) {
viewController.hidesBottomBarWhenPushed = true
super.pushViewController(viewController, animated: animated)
}
} |