UISplitViewController 可以作为 UINavigationController 中的根控制器吗?

发布于 2024-09-19 01:45:42 字数 469 浏览 7 评论 0原文

界面生成器不允许您添加 UISplitViewController 作为 UINavigationController 的根控制器。 我还尝试以编程方式创建 UINavigationController 并将其根视图控制器设置为 UISplitViewController。

结果是一个空窗口,只有导航栏。

我还尝试过分割视图控制器替代品 MGSplitViewController。它大部分工作正常,除了在分割视图控制器中,主视图是另一个 UINavigationController。它的导航栏显示得太粗。改变方向和背部可以清除它。

我一直在尝试各种不同的方法来获得看起来像分割视图的视图和我在之间切换的其他视图。我已经尝试在选项卡视图控制器中编写自己的控制器来管理窗口的子视图并将分割视图作为托管视图,现在是导航控制器。所有尝试都存在一些问题。最一致的问题是关于视图的方向。我的应用程序在横向模式下运行,通常子视图认为它仍然是纵向的。

任何想法表示赞赏。

Interface builder does not allow you to add a UISplitViewController as the root controller of a UINavigationController.
I've also tried programmatically creating the UINavigationController and setting its root view controller to be the UISplitViewController.

The result is an empty window with just the nav bar.

I've also tried a split view controller replacement, MGSplitViewController. It mostly works, except that within the split view controller, the master view is another UINavigationController. Its nav bar shows up too thick. Changing orientation and back clears it up.

I've been trying all sorts of different approaches to having a view that looks like a split view and other views that I switch between. I've tried within a tab view controller, writing my own controller to manage subviews of the window and having the split view as a managed view, and now the navigation controller. All attempts have had some issues. The most consistent issue is regarding the orientation of the view. My app is running in landscape mode and typically the child views think its still portrait.

Any ideas appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

尘世孤行 2024-09-26 01:45:42

不。

底线:UISplitViewController 必须是应用程序(或者更具体地说,窗口)的根视图。它不能存在于 UINavigationController 或其他任何东西中。

当前 SDK 就是这种情况,并且不保证未来 SDK 中会发生变化。

No.

The bottom line: a UISplitViewController must be the root view of an app (or perhaps more specifically, a window). It can not live inside a UINavigationController or anything else.

This is the case with the current SDK, and there's no guarantee that will change in future SDKs.

唱一曲作罢 2024-09-26 01:45:42

将分割视图添加到导航堆栈似乎很奇怪。分割视图控制器的主窗格通常是导航控制器,因此(在不了解您的设计的更多信息的情况下),我可能会使用它来控制您的导航层次结构。

It seems strange to add a split view to a navigation stack. The master pane of a split view controller is generally a navigation controller, so (without knowing more about your design), I'd probably use that to control your navigation hierarchy.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文