Removing storyboards from Xcode 5's default single view app template

Oct 6, 2013 00:00 · 194 words · 1 minute read

The new default single-view application template in Xcode 5 is based on Storyboards rather than the previous view-controller-and-nib-files approach. That’s fine if you like Storyboards, but I don’t - so the first thing I do when starting a new project is rip them out and replace them with the old approach.

This is by way of an outboard brain dump to remind myself of how this is done.

Remove the Main.storyboard file

This can simply be deleted.

Update the ProjectName-Info.plist file

Remove the Main storyboard base file name key.

  1. Create a nib file (File -> New -> File -> View)
  2. Update the File's Owner's class to whatever the project’s view controller is called
  3. Link the File's Owner's view outlet to the view object in the nib file

Update the app delegate

  1. Import the project’s view controller’s header file
  2. Update the application:didFinishLaunchingWithOptions: method:

{% codeblock lang:objc) - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; MyViewController *viewController = [[MyViewController alloc] initWithNibName:@“MyViewController” bundle:nil]; self.window.rootViewController = viewController; [self.window makeKeyAndVisible]; return YES; } {% endcodeblock)