gpt4 book ai didi

ios - 在容器中显示 UIViewController

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

我有一个 UIViewController。在这个 UIViewcontroller 中有一个容器。在这个容器中是一个标签栏 Controller 。其中一个选项卡是嵌入在导航 Controller 中的 PageViewController。其中一个页面是 UITableViewController。

UIViewController->Container->TabBarController->NavigationController->PageViewController->UITableViewController

如果您单击其中一个单元格,我想显示一个 UIViewContoller。但是这个 UIViewcontroller 应该只在容器和 NavigationController 中。如果我单击一个单元格,您可以在 0.3 秒内看到正确的结果。在导航栏上有一个“后退”按钮。但随后 UIViewController 切换到全尺寸。

我按如下方式显示 UIViewController:

let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("article")
self.presentViewController(vc, animated: true, completion: nil)

我得到以下警告:

Presenting view controllers on detached view controllers is discouraged <Test.AllArticlesTableViewController: 0x7f812bd227d0>.

我希望有人能帮助我。

最佳答案

呈现 View Controller 将默认占据全屏。我相信您正在寻找的是将 View Controller 推送到导航堆栈上。使用 pushViewController(_:animated:)

示例:

self.navigationController.pushViewController(vc, animated: true)

"Pushing a view controller causes its view to be embedded in the navigation interface."

请引用Apple docs获取更多信息。

关于ios - 在容器中显示 UIViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39068930/

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