Replacing storyboard with gold old fashion XIBs


I am replacing my storyboards with good old fashion XIB’s to make my app compatible with pre iOS 5 devices

1. Click on your target and set the storyboard to blank

2. Create a new class that is a subclass of

UIViewController called MainViewController and make sure the create XIB is selected

3. Add the following to the existing AppDelegate.h file

#import “MainViewController.h”

@property (strong, nonatomic) MainViewController *viewController;

4.In didFinishLaunchingWithOptions in MainViewController.m

add the following:

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

self.viewController = [[MainViewController alloc] initWithNibName:@”MainViewController” bundle:nil];

self.window.rootViewController = self.viewController;

[self.window makeKeyAndVisible];

return YES;

And behold the new XIB starts as expected – of course I now need to extract all the UI elements out of the existing storyboard…

Dom

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s