[英]How do I create a custom container view for an iOS App?
I am starting out developing an iPad App, and I would like for there to be a toolbar bar at the top that will present different views beneath it as pictured below: 我正在开始开发iPad App,我希望顶部有一个工具栏,在其下方将显示不同的视图,如下图所示:
So when each button is pressed, the toolbar should remain in place and different view controller should present its view in that space. 因此,当按下每个按钮时,工具栏应保留在原处,并且其他视图控制器应在该空间中显示其视图。 I read through Apples ViewController programming guide, and it seems like this is possible, but I just somehow didn't get the actual methods that I needed to get a view controller to display its view inside that bottom rectangle.
我通读了《 Apples ViewController编程指南》,这似乎是可行的,但是我却以某种方式没有获得所需的实际方法,而该方法需要一个视图控制器才能在底部矩形内显示其视图。
Is it reasonable to have a container view which manages the toolbar, and then creates a view controller to display a sub view within that lower rectangle? 拥有一个管理工具栏的容器视图,然后创建一个视图控制器以显示该下部矩形内的子视图是否合理?
EDIT: 编辑:
I would like to do something along these lines: 我想按照以下方式做一些事情:
-(IBAction)hitMapButton{
MapViewController *mapView = [[MapViewController alloc] initWithNibName:@"MapView" bundle:nil];
[self addChildViewController:mapView];
[mapView release];
}
But I can't figure out how to actually get the view to draw? 但是我不知道如何实际绘制视图?
Search the Apple documentation with 'Creating a Tab Bar'. 使用“创建标签栏”搜索Apple文档。 You'll find several documents: creating programmatically, creating with segue, etc. There are also a number of sample projects that you can view based on that search, for example 'Tabster' (an iPhone app that is a bit dated but will certainly help you - edit the target to be 'iPad').
您会找到几个文档:以编程方式创建,使用segue创建等。您还可以基于该搜索查看许多示例项目,例如“ Tabster”(一种过时的iPhone应用程序,但肯定会帮助您-将目标设置为“ iPad”)。
You can get a working staring point by creating a new Xcode project and selecting 'Tabbed Application' 通过创建一个新的Xcode项目并选择“ Tabbed Application”,您可以得到一个有效的凝视点。
Note that the UITabBarController puts the tab bar at the bottom - if you are thinking about putting it at the top you should also read the 'User Experience Guidelines' 请注意,UITabBarController将选项卡栏放在底部-如果您正在考虑将其放在顶部,则还应该阅读“用户体验指南”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.