THE SINGLE VIEW APPLICATION TEMPLATE

When you create a Single View Application project using Xcode, you automatically have a single view in your application. Until now, you have been using it without understanding much about how it works under the hood. In the following Try It Out, you will dive into the details and unravel all the magic that makes your application work.

TRY IT OUT: Creating a Single View Application Project

image

  1. Using Xcode, create a Single View Application (iPhone) project (see Figure 4-1) and click Next.

    image

    FIGURE 4-1

  2. Name the project SingleViewBasedApp. Set the Class Prefix to be SingleViewBasedApp and ensure that you have the Use Automatic Reference Counting option unchecked. Click Next and then Create.
  3. Press Command-R to test the application on the iPhone Simulator. The application displays an empty screen, as shown in Figure 4-2.

How It Works

What you have just created is a Single View Application project. By default, the Single View Application template includes a single View window, controlled by a View controller class.

First, take a look at the files and folders created for your project in Xcode. In particular, note the folders and files listed under the project name (see Figure 4-3).

FIGURE 4-2

FIGURE 4-3

As you can see, many files are created for you by ...

Get Beginning iOS 5 Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.