设置NavigationBar隐藏和显示 发表于 2017-07-04 更新于 2020-03-11 分类于 随笔 页面隐藏和显示navigation注意要使用setNavigationBarHidden(true, animated: true)方法,直接设置值,防止过于突兀。 1234override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) self.navigationController?.setNavigationBarHidden(true, animated: true)}1234override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) self.navigationController?.setNavigationBarHidden(false, animated: true)}