Setting Up a New Project

Set up a new project for an extensible application.

  1. Start XCode, and create a new project.

    Set up new project
  2. In the left pane, under iOS, select Application. In the right pane, select Single View Application.

    Single View Applications
  3. Complete the details on the first screen, then click Next to build an iPhone-only ap that uses ARC (Automatic Reference Counting).
    Note: You are not required to use ARC; however, if you use MRC (Manual Reference Counting), you are then responsible for manually retaining and releasing your objects. If you plan to use MRC, appropriately adapt the tutorial code to prevent memory leaks and Xcode warnings.

    Set up options
  4. After you have created your project, you see this screen in Xcode:

    New Project Created

    Xcode automatically creates some classes: an application delegate, a view controller, and the belonging lib. If you run the app now, you see a grey screen, as no controller logic has yet been implemented.
    No controller logic

The ViewController is instantiated in the AppDelegate's didFinishLaunchingWithOptions: method; it is then assigned to the app's window as root view controller, and finally the window is made visible - this is all the boilerplate code does:
@implementation AppDelegate
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}