gpt4 book ai didi

ios - 使用标签栏 Controller 和导航 Controller

转载 作者:行者123 更新时间:2023-11-30 13:29:38 24 4
gpt4 key购买 nike

enter image description here

我想在显示的 View Controller 之间导航。我不想使用segues。

当我尝试通过单击按钮将表单 FirstViewController 导航到 SecondViewController 时:

 let next = self.storyboard?.instantiateViewControllerWithIdentifier("secondViewController") as! SecondViewController

self.presentViewController(next, animated: true, completion: nil)

我得到:

Warning: Attempt to present SecondViewController on FirstViewController whose view is not in the window hierarchy!

有什么想法如何在中间插入导航 Controller 吗?

编辑:图中是TabBarController而不是TabViewController

我使用以下命令从第一个场景的名为“A-Controller”的 Controller 导航到第一个 View Controller :

@IBAction func navigateToFirstViewController(sender: AnyObject) {
let next = self.storyboard?.instantiateViewControllerWithIdentifier("firstViewController") as! FirstViewController
self.presentViewController(next, animated: true, completion: nil)
}

图中未显示。

最佳答案

如果您尝试通过 TabBarController 呈现模态视图,则:

let next = self.storyboard?.instantiateViewControllerWithIdentifier("secondViewController") as! UIViewController
self.tabBarController.presentViewController(next, animated: true, completion: nil)

关于ios - 使用标签栏 Controller 和导航 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36719125/

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