If you have an existing app which uses individual .xib files for each screen do this to convert it to use a storyboard.

The apple guide this is based on is here.

Create AppDelegate if necessary

Check your has projectnameAppDelegate.h and .m (if not see the apple guide above to create one)

Update main.m

Your existing main.m file probably looks something like this:

#import <UIKit/UIKit.h>


int main(int argc, char *argv[]) {


    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    int retVal = UIApplicationMain(argc, argv, nil, nil);

    [pool release];

    return retVal;


Change it to look like this:

#import <UIKit/UIKit.h>

#import "yourprojectnameAppDelegate.h"


int main(int argc, char *argv[]) {


    @autoreleasepool {

        return UIApplicationMain(argc, argv, nil, NSStringFromClass([yourprojectnameAppDelegate class]));



(replace “yourprojectnameAppDelegate” with the name of your application delegate class).

Add A Storyboard

Right click the folder to add it in (typically your main project folder) > New File > iOS > User Interface > Storyboard

Name it "MainStoryboard"

Now add your first view controller to the storyboard from the Object library.

If the first view controller is embedded in a container such as a navigation controller or tab bar controller see the apple guide above.

Set the main storyboard for the project

Select the project in the left view and then select it in the Targets section shown.  In 'Main Interface' select your MainStoryboard.

That's as far as the apple guide gets you (unless using tables – see the guide link above).

Move XIB's To The Storyboard

In the storyboard

Click the top bar of the first scene in the storyboard created and then in the attributes panel select the 'Is Initial View Controller' checkbox.

Now copy the elements of your first #ViewController XIB and paste them into the scene.

Rename your .h and .m files if you want to (older projects often named them with "_iPhone" and similar things at the end which you might not want any more).  If you do also rename the @interface and @implementation names in those files too.

In the storyboard select the scenes top bar and in the identity inspector, change the class to the name of your ViewController files.

Now you can link all of the view objects to the View Controller in the top bar as normal.

In the ViewController Files

If you want to (doesn't seem to be mandatory) change your outlets to be nonatomic strong properties in the .h file:

@interface SomethingViewController : UIViewController

@property (nonatomic, strong) IBOutlet UILabel *MyLabel;
@property (nonatomic, strong) NSString *SomeString;


And if so add synthesize statements for them also in the .m file.

@implementation SomethingViewController

@synthesize MyLabel;
@synthesize SomeString;

All of the existing viewWilAppear() etc methods can be retained.  You may want to add this one also:

#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
Stop your existing main view being created

Find where your original main view is displayed by your app and disable it.  E.g. search for " [self.window makeKeyAndVisible]; " which is likely used to show it.

You shoud now be able to run your app and see the first view. 

From here add segues, deal with using segues instead of creating ViewControllers to disaplay new views as necessary for your app, etc.


UK Electronic Designer