Ayush Agarwal
Ayush Agarwal

Reputation: 71

There is no .xib file when I create a new "Empty Application" in XCode

I am working through the Big Nerd Ranch Guide (2nd Ed) for iOS Programming using Xcode version 4.2.

For the very first project I'm asked to create a new project which is a "Window-based Application" the description for which reads "This template provides a starting point for any application. It provides just an application delegate and a window". The "Window-based Application" option was not available to me in XCode 4.2 but I did see the option to create a "New Empty Application" which has the same description ("This template provides a starting point for any application. It provides just an application delegate and a window")

When I create the project I'm supposed to have a MainWindow.xib file but that does not show up at all in my project? Help please

Upvotes: 7

Views: 20317

Answers (5)

d.ennis
d.ennis

Reputation: 3455

You can also create a MainWindow.xib afterwards:

File > New > File >

There should be a Window.xib. If not, creat an empty .XIB file and drag a window (UIWindow) into your Objects pane. Copy the connections as they are displayed in the book.

Hope that helps.

PS.:I recommend to not use beta software to start with iOS

Upvotes: 1

Steve Ham
Steve Ham

Reputation: 3154

I am using the same book, had the same problem but I figured how to fix it.

  1. Create a new xib file by

right click Quiz folder -> New File -> iOS -> User Interface -> Window -> click Next

  1. click the Window.xib file then find an Object and drag it under Objects -> select the third tab on the right -> change this class to AppDelegate

click File's Owner -> change this class to UIApplication -> click the 6th tab and connect delegate to Window

  1. goto AppDelegate.h and put IBOutlet in front of UIWindow *window;

goto Window.xib again and connect window under Outlets to Window.

Also in plist file add a row key - Main nib file base name type - string value - mainwindow

Hope this helps.

Upvotes: 5

user99070
user99070

Reputation:

Please read this in the official Forum to the Book. BNR posted a project that you can use as your default Project for all Chapters in this Book. They created a small Project that looks as if you created an empty project with the XCode version before iOS5 was released.

http://forums.bignerdranch.com/viewtopic.php?f=74&t=1817

regards

Thomas

Upvotes: 1

Roger
Roger

Reputation: 7610

If you create a empty project and do want to use storyboading, then do:

  1. create empty project
  2. add new file (storyboard)
  3. make sure to add a correct entry in your app-info.plist file. (Just create a simple project with storyboard and look-up the key there in the app-plist).
  4. throw a view controller on the board, and off you go.

Like this you have a nice clean project, with the use of the storyboard feature.

Upvotes: 1

dreamwitz
dreamwitz

Reputation: 111

When you create the project, don't forget to uncheck the option "storyboard". Once you uncheck it, you can see the xib files.

Upvotes: 11

Related Questions