Akhtar
Akhtar

Reputation: 3202

There is no .xib file when I create a new "Single View Application" in XCode 5

when i create a new project selecting option (single view application) in xcode 5, it automatically add Main.storyboard there is no option for selecting .Xib file as we select in previous version of xcode. Please someone explain this

Upvotes: 12

Views: 13085

Answers (2)

IDev
IDev

Reputation: 1217

For adding XIB in xcode 5, use Empty application rather than single view application. Refer to this question for a simple way to integrate a XIB.

Upvotes: 10

Matti
Matti

Reputation: 430

My suggestion is:

  1. Create an empty app
  2. Go to File/New/File, Choose Objective-C Class
  3. Name your class ViewController(or whatever you like), make it subclass of UIViewController Make sure you have checked the box "with xib for user interface."

  4. Open appDelegate.h, put

@class ViewController;

between @interface and #import, and this property below:

@property (strong, nonatomic) UIViewController *viewController;
  1. Open your appDelegate.m: import your ViewController

#import "ViewController.h"

and before

[self.window makeKeyAndVisible];

put

 self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
    self.window.rootViewController = self.viewController;

Upvotes: 20

Related Questions