Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use storyboards in a project which has .xib files- iPhone

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?

like image 926
gsach Avatar asked Mar 14 '12 12:03

gsach


People also ask

What are iOS storyboards?

A storyboard is a visual representation of the user interface of an iOS application, showing screens of content and the connections between those screens.

How do I add a storyboard to an existing XCode project?

Those exact steps (I am using XCode 4.5 and iOS 6.0 ): Add new storyboard to the project by File->New->File... ->Userinterface->storyboard. Go to project summary and select MainStoryboard and select the storyboard name you just created.

What's the difference between XIB and storyboard?

A storyboard is like a canvas where you put all your . xib files. You no longer have any . xibs, you just have View Controllers directly on your canvas.


1 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:

  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.
like image 67
Jon Hess Avatar answered Sep 23 '22 12:09

Jon Hess