gpt4 book ai didi

swift - 如何在 Swift3 中覆盖 viewWillDisappear

转载 作者:搜寻专家 更新时间:2023-10-30 22:29:30 24 4
gpt4 key购买 nike

我试图隐藏第一个导航栏并显示所有其他导航栏,所以我使用了:

override func viewWillAppear(_ animated: Bool) {
// Hide the navigation bar on the this view controller
self.navigationController?.setNavigationBarHidden(true, animated: true)
}

override func viewWillDisappear(_ animated: Bool) {
// Show the navigation bar on other view controllers
self.navigationController?.setNavigationBarHidden(false, animated: true)
}

我现在需要调用 super 方法:super.viewWillAppear(animated)super.viewWillDisappear(animated),但我不知道在哪里或怎么样,有什么建议吗?

最佳答案

你的代码看起来像

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Hide the navigation bar on the this view controller
self.navigationController?.setNavigationBarHidden(true, animated: true)
}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
// Show the navigation bar on other view controllers
self.navigationController?.setNavigationBarHidden(false, animated: true)
}

关于swift - 如何在 Swift3 中覆盖 viewWillDisappear,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40347802/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com