Swift-显/影导航栏标签栏

跳转到当前页面时隐藏导航栏,返回上一级时显示导航栏
override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    self.navigationController?.navigationBar.isHidden = true
}

override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)
    self.navigationController?.navigationBar.isHidden = false
}
场景:
当前控制器有标签栏,点击跳转到下一个界面时,需要隐藏标签栏,返回当前控制器时,标签栏又显示
vc.hidesBottomBarWhenPushed = true

你可能感兴趣的:(Swift-显/影导航栏标签栏)