在Swift 3
中测试过
注意:以下代码仅在第一个VC上隐藏navigationBar
。当滑动时。
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
navigationController?.hidesBarsOnSwipe = true
}
override func viewWillDisappear(_ animated: Bool) {
navigationController?.hidesBarsOnSwipe = false
}
输出: