在我的第一个viewController中,我使用以下代码隐藏了导航栏。
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.setNavigationBarHidden(true, animated: false)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationController?.setNavigationBarHidden(false, animated: true)
}
但是当我去其他viewcontroler并想要从左向右滑动(滑动)时,它被视为重叠
我附上图片了解更多细节:
答案 0 :(得分:1)
尝试改变这一点:
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.setNavigationBarHidden(true, animated: false)
}
对此:
var firstEntrance = true
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if firstEntrance {
self.navigationController?.setNavigationBarHidden(true, animated: false)
} else {
firstEntrance = false
self.navigationController?.setNavigationBarHidden(true, animated: true)
}
}