简体   繁体   English

如何将另一个子视图添加到NavigationController视图

[英]How to add another subview to a NavigationController view

I have a window and add a navigation controller's view to it, all I want is for the navigation controller's view to take half of the window (top half) and want to add another view to bottom half. 我有一个窗口,并向其中添加了导航控制器的视图,我想要的只是导航控制器的视图占据一半的窗口(上半部分),并希望向下半部分添加另一个视图。 I'm trying to set the frame for navigation controller's view, but 0,0 is the topmost point on screen (doesn't count the iPhone's status bar). 我正在尝试为导航控制器的视图设置框架,但是0,0是屏幕上的最高点(不计算iPhone的状态栏)。 I can find (hopefully) an API to give me the size of the status bar, but I suspect there is a more civilised way of doing this. 我可以(希望)找到一个API来给我状态栏的大小,但是我怀疑这样做有更文明的方法。 any help appreciated. 任何帮助表示赞赏。

Your UIView class allows you to add multiple subviews into it. 您的UIView类允许您向其中添加多个子视图。 What you should do is just layout two subviews, one in the top, other in the bottom. 您应该做的只是布局两个子视图,一个在顶部,另一个在底部。 Use the addSubview method on your UIView to add as many views as you want to the parent view. 在UIView上使用addSubview方法可将所需数量的视图添加到父视图。 You may be interested in reading the 'Creating and Managing the View Hierarchy' 您可能对阅读“创建和管理视图层次结构”感兴趣

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM