O'Reilly logo

Learning iOS Programming, 2nd Edition by Alasdair Allan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Table View–Based Applications

The 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 along.

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 CityGuide, and then in the Company Identifier box enter the root part of your Bundle Identifier (as we did in Chapter 3; also see the section ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required