UIView 内的 UINavigationController
我可以通过编程方式将 UINavigationController 添加到 UIView,但这在 IB 中是如何表示的?
每次我将 UINavigationController 添加到视图层次结构时,它都会保持与(根)UIView 相同的级别。这是正常的吗?
我希望能够将 UINavigationController “拖动”到视图下方。
View
- UINavigationController
- UIView
但相反,我进入了 IB:
View
-UIView
UINavigationController
在我的应用程序中,我基本上有一个包含两个部分的视图,顶部部分是 UIView,底部部分是 UINaivationController。 (将其视为类似垂直分割视图的东西)
我的主要问题是:在设计视图期间,在 IB 中看到 UINaigationController 与 IB 中的根视图处于同一级别是否正常?
I can adda UINavigationController to a UIView programmatically but how is this represented in IB?
Everytime I add UINavigationController to the view heirarchy it stays at the same level as the (root) UIView. Is this normal?
I expected to be able to "drag" the UINavigationController underneath the View.
View
- UINavigationController
- UIView
but instead I get in IB:
View
-UIView
UINavigationController
I basically have, in my app, a View that contains two sections, the top section is a UIView and the bottom section is the UINaivationController. (think of it as something like a split view but vertically)
my main question is this: Is it normal to see the UINaigationController at the same level as the root view in IB during design the views?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
差不多了。 IB 并没有真正让你对控制器拥有的视图做太多事情;您需要一个指向该导航控制器的插座,然后在
-viewDidLoad
或-application:didFinishLaunchingWithOptions:
或其他内容中,将导航控制器的视图添加到您想要的任何视图作为其父级,即Pretty much. IB doesn't really let you do much with controller-owned views; you'll need an outlet pointing to that navigation controller, then, in
-viewDidLoad
or-application:didFinishLaunchingWithOptions:
or whatever, add the navigation controller's view to whatever view you want as its parent, i.e.