gpt4 book ai didi

ios - 如何跳转到另一个 UINavigationController 中的任何 ViewController

转载 作者:可可西里 更新时间:2023-11-01 01:43:55 26 4
gpt4 key购买 nike

我有一个使用 Storyboard创建的项目。我有很多 ViewControllers,与 segues 相连。现在我想从 ViewController(下面的 VC)A 获取,它嵌入在 navigationController(作为 RootVC)中,并由另一个 VC B(也由另一个 VC C 模态地呈现)以模态转场呈现给任何其他 VC Storyboard中的 D(在本例中是主导航 Controller E 中的第一个)。我经历过 NavigationController 层次结构被模态 segue“破坏”,并且因为我需要在 VC A 中使用 push segue 的功能,所以我需要使用第二个 NavigationController ...我已经尝试保存一个实例全局目标 VC D 然后跳转到那里

    self.navigationController.popToViewController(myDestinationVC_D, animated: true)

但是由于解压了一个 nil-optional,我得到了一个错误。

我希望你能帮助我。我认为给定的信息应该足够了,但如果您需要更多信息,请发表评论。 (我希望我的英语不会太差;))谢谢!

最佳答案

我打算用 objective-c 编写,但我相信您可以转换为 swift。

some *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"some identifier you add to a vc in the storyboard"];

只需按下即可查看。

关于ios - 如何跳转到另一个 UINavigationController 中的任何 ViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25431727/

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