在具有.xib文件的项目中使用故事板 - iPhone [英] Use storyboards in a project which has .xib files- iPhone
问题描述
我想在我的iPhone应用程序中一般使用旧的.xib文件。但是当涉及到tableViewController storyboard是一个很多更方便为了使自定义单元格等。是否可以做一个基于.xib的应用程序,在它的中间,使用一个故事板的UITableViewController和它的DetailedViewController只?
I want to use generally the old .xib files in my iPhone application. But when it comes to tableViewController storyboard is a lot more convenient in order to make custom cells etc. Is it possible to make a .xib based application and in the middle of it, to use a storyboard for a UITableViewController and its DetailedViewController only?
推荐答案
您可以为程序的任何部分使用故事板。故事板不是一个全或无的概念。
You can use a storyboard for any part of a program. Storyboards are not an all or nothing concept. You can have just one view controller in a storyboard, or a small network that just represents a subsection of your app.
从故事板中只使用一个视图控制器:
To use just one view controller from a storyboard:
- 向现有项目添加新的故事板。
- 将一个视图控制器添加到故事板。
- 在检查器中为视图控制器分配标识符。
- 使用UIStoryboard类加载故事板资源
- 使用 - [UIStoryboard instantiateViewControllerWithIdentifier:]来创建该视图控制器的新实例。
- 通过执行某些操作将视图控制器安装到某个地方控制器,或以模态方式运行。
- Add a new storyboard to your existing project.
- Add a single view controller to the storyboard.
- Assign an identifier to the view controller in the inspector.
- Use the UIStoryboard class to load the storyboard resource
- Use -[UIStoryboard instantiateViewControllerWithIdentifier:] to create a new instance of that view controller.
- Install the view controller some place in your app by doing something like pushing it on to a navigation controller, or run it modally.
这篇关于在具有.xib文件的项目中使用故事板 - iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!