gpt4 book ai didi

ios - self?.performSegue 不显示导航栏

转载 作者:可可西里 更新时间:2023-11-01 00:00:07 25 4
gpt4 key购买 nike

self?.performSegue(withIdentifier: "myview", sender: nil)

即使我在 Storyboard 中使用推送,以上代码也不会显示导航栏。下面的代码向我显示了一个错误,即使存在具有正确名称的 segue

self?.navigationController?.performSegue(withIdentifier: "myview", sender: nil)

错误

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier 'myview''

最佳答案

你的导航栏可能被隐藏了,尝试在 viewcontroller 中添加这段代码,它被 segue 调用

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

注意:请检查使用“myView”推送转场的 viewController 是否嵌入到 UINavigationController 中。

关于ios - self?.performSegue 不显示导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45710823/

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