Chapter 2. Building a Basic iPhone Application

In This Chapter

Building your first iPhone Application
Using Interface Builder to build a basic GUI for an app
Implementing a very simple UIViewController
Running your basic app on your iPhone

Now that you're a bit more familiar with the tools that you're going to be using for developing on the iPhone, let's look at how to build a very basic iPhone application.

In this chapter, you're going to build a simple iPhone application that will have a text field to display some output and a button to show a small amount of interactivity. When you're finished with this application you will be familiar with the basics of launching an iPhone application from Xcode and running it in the simulator. Additionally, before you're finished, you will run the application on your iPhone to see it running on an actual device.

You begin by choosing one of the templates available from the New Project menu in Xcode.

Creating a Project from a Template

The first thing you'll do to create this basic iPhone application is open up Xcode and go to the New Project menu item, which you will find under the File menu. This presents you with the dialog shown in Figure 2.1. For the purposes of this demonstration, you will choose to create a View-Based Application.

Once you have created this project, Xcode already has files that correspond to the user interface, or UI, for your application, a controller for your view, and various other housekeeping files. It also has preconfigured ...

Get Cocoa Touch™ for iPhone® OS 3 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.