Jeremy L
Jeremy L

Reputation: 3810

How do we create an iOS project with a clean slate (with no Interface Builder files)?

A book described the following steps for a project without any Interface Builder files:

  1. After creating a Single View Application, delete the .xib file
  2. Find the ProjectName-Info.plist file and remove the Main nib file base name property. (select it and press Delete)
  3. Find main.m and change the last argument for UIApplicationMain to @"ProjectNameAppDelegate"
  4. remove a @property line in ProjectNameAppDelegate.h and @synthesize in ProjectNameAppDelegate.m

I can't find (2) above for the property, and since I am using Xcode 4.3.2, the ProjectNameAppDelegate.h has become AppDelegate.h (the .m as well)... I also see a window and viewController properties there... and doesn't look like they need to be removed as in step 4. How can it be done if it is Xcode 4.3.2 (or later?)

Upvotes: 0

Views: 190

Answers (1)

Jim
Jim

Reputation: 73936

If you want to create a project with a clean slate, Xcode provides a template called Empty Application.

The standard templates don't include a main window nib any more, so the change in #2 is not necessary. You should make sure you don't enable storyboards when you create your project though.

Yes, the application delegate is just called AppDelegate now. It's just a name. It doesn't matter.

Edit:

Steps to create an iPhone application with a view controller from an empty application template:

  1. Create a new project using the Empty Application template.
  2. Create a new file, pick the Objective-C class template. Make it a subclass of UIViewController.
  3. Alter AppDelegate.h to import your view controller header.
  4. Create an instance variable for your application delegate to hold your view controller.
  5. Alter application:didFinishLaunchingWithOptions: to instantiate your view controller, assign it to the instance variable, and add its view as a subview to the window.

Upvotes: 3

Related Questions