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?
3 Answers
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:
- 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.

- 14,237
- 1
- 47
- 51
Both can work fine together (Storyboards and Nib files). In the TVC that is part of your storyboard, just instantiate the destination VC in code and use the usual initWithNibName method to load the nib file.

- 14,445
- 5
- 38
- 62
-
Maybe i did not explain well what I want to do. I want to start the application development without storyboard. Then, when I create a TVC i want to create it with a storyboard so as to customize easily the cells. How do i create it? [tvc alloc] initwith ??] , and then push tvc in the navigation stack. – gsach Mar 14 '12 at 14:22
-
Have you checked out the class reference? https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIStoryboard_Class/Reference/Reference.html It is pretty straightforward. Also a quick question, have you thought about switching to doing the UI development using storyboard instead of nibs? Any inclusion of a storyboard (even for TVC purposes) means the app has to be run on iOS 5 devices. Why then, not go all in and use storyboard for most all UI? It is far easier and faster once you get used to it. – LJ Wilson Mar 14 '12 at 14:43
-
Is it not possible to have the storyboard -> xib transition go without writing code? From the WWDC video 2012 I got this impression. – DrMickeyLauer Jul 09 '12 at 14:39
You can add a storyboard to any project, but the point of storyboards is to centralize your XIB files into one location rather than having 10 XIB files you can have 1 .storyboard
file that contains 10 scenes representing your views. This shows your connections to other scenes, and you can manage all the seques and transitions of each scene. So is it possible, yes you could add a storyboard to your project, but I would recommend you design you entire application in a storyboard if you want to use them.

- 8,031
- 11
- 67
- 110
-
I want to use them only the tableView convenience it offers. How I can do it? – gsach Mar 14 '12 at 12:54
-
The tableView connivence is part of the storyboard, to use this feature you have to use a storyboard. Also if you choose to use a XIB and a storyboard remember you will need to target only 5.0 devices otherwise it wont work. – atrljoe Mar 14 '12 at 13:02