gpt4 book ai didi

Swift:在模态中强制显示导航栏

转载 作者:IT王子 更新时间:2023-10-29 05:22:58 34 4
gpt4 key购买 nike

我的 Swift 项目中有以下 Storyboard Segue:

enter image description here

动画是正确的,但是目标 View Controller 中没有导航栏。我想强制目标 View Controller 有一个导航栏。我在目标 View Controller 中尝试过:

override func viewWillAppear(animated: Bool) {
super.viewWillAppear(true)
navigationController?.navigationBar.hidden = false
}

或者:

override func viewWillAppear(animated: Bool) {
self.navigationController?.setNavigationBarHidden(false, animated: true)
}

但它拒绝显示任何导航栏。

如何执行垂直转场(如“Cover Vertical”),但仍会在目标 View Controller 中显示半透明的导航栏?

编辑:目标 View Controller 的我的属性检查器:

enter image description here

最佳答案

尝试将 Segue 创建到导航 Controller 而不是 View Controller 。导航栏仅针对导航堆栈中的 View Controller 显示。在您的情况下,源 View Controller 似乎在导航堆栈中,但不在呈现的 View Controller 中。尝试这样的事情:

enter image description here

关于Swift:在模态中强制显示导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28401210/

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