Chapter 5. Table View–Based Applications
UITableView and associated
classes are perhaps the most commonly used classes when building user
interfaces for your iOS applications, especially for the iPhone and iPod
touch. Due to the nature of the applications, you can use these classes to
solve a large cross section of problems, and as a result, they appear almost
everywhere. In this chapter, we’re going to dive fairly deeply into the
table view classes, and by the end of it, you’ll be able to produce
UITableView-based applications on your own. We’ll
also discuss some features of Xcode and Interface Builder as we go
We’re going to write a simple guidebook application. We’ll start by
displaying a list of cities in a table (using the
UITableView class). Then we’ll add the ability to
click on the city name inside each table cell (each cell is a
UITableViewCell object), which will take you to a
page describing the city. Later in the chapter, I’ll show you how to add and
delete cities to and from the guidebook. By the end of the chapter, we will
have a working application.
Creating the Project
Open Xcode and select “Create a new Xcode project” in the startup window, choosing a Single View Application template from the template pop-up window—the same template we used for the Hello World application back in Chapter 3.
In the Product Name box, enter
then in the Company Identifier box enter the root part of your Bundle
Identifier (as we did in Chapter 3; also see the section ...