UISplitViewController 可以作为 UINavigationController 中的根控制器吗?
界面生成器不允许您添加 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不。
底线:
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 aUINavigationController
or anything else.This is the case with the current SDK, and there's no guarantee that will change in future SDKs.
将分割视图添加到导航堆栈似乎很奇怪。分割视图控制器的主窗格通常是导航控制器,因此(在不了解您的设计的更多信息的情况下),我可能会使用它来控制您的导航层次结构。
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.