gpt4 book ai didi

ios - 实例化后如何推送导航 Controller

转载 作者:行者123 更新时间:2023-11-28 06:15:52 24 4
gpt4 key购买 nike

我想推送我的导航 Controller ,但我得到:
不支持推送导航 Controller

enter image description here

我无法实例化我的 TableView。

这是我的代码:

let newViewController = storyboard!.instantiateViewController(withIdentifier: "player") as! UINavigationController
self.navigationController?.pushViewController(newViewController, animated: true)

那么有办法推送 NavigationController 吗?

最佳答案

这里我们可以看到第一行意味着 View Controller 的堆栈提供向下钻取,所以你必须将至少一个 UIViewController 对象压入堆栈或将堆栈的根设为导航 Controller 的任何 View Controller 。

来自苹果文档。

A navigation controller manages a stack of view controllers to provide a drill-down interface for hierarchical content. The view hierarchy of a navigation controller is self contained. It is composed of views that the navigation controller manages directly and views that are managed by content view controllers you provide. Each content view controller manages a distinct view hierarchy, and the navigation controller coordinates the navigation between these view hierarchies.

阅读this

关于ios - 实例化后如何推送导航 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45165869/

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