18
votes

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

3 Answers

27
votes

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:

  1. Add a new storyboard to your existing project.
  2. Add a single view controller to the storyboard.
  3. Assign an identifier to the view controller in the inspector.
  4. Use the UIStoryboard class to load the storyboard resource
  5. Use -[UIStoryboard instantiateViewControllerWithIdentifier:] to create a new instance of that view controller.
  6. Install the view controller some place in your app by doing something like pushing it on to a navigation controller, or run it modally.
4
votes

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.

1
votes

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.