Chapter 13

Table Views

To display a list of values, the table view is one of the most common user interface elements in iOS development. The table view is more common in iPhone applications than in iPad applications because of the size of the viewing area.

In addition to displaying a scrollable list of data, you can present the list in the following ways to make viewing easier:

  • As an indexed list
  • As a part of related groups

Developers use the table view within a navigation controller–based application as a way to drill down through a hierarchical set of data. This style of application can be created easily by choosing the Master-Detail Application from the application template upon Xcode project creation.

The physical makeup of the table view is limited to a single-column vertical scrolling control. The list can be presented in groups along with a header and footer for each group section, and each section contains a row of data related to that specific section.

The Contacts application that is pre-installed on all iOS devices uses the indexed format to present names. The sections are grouped by the letters of the alphabet, and within each letter group, are the rows of names beginning with that letter. For example, under the group J would be a name Jones.

In this lesson you learn how to add data to a table view. You learn how to group related information into sections, and you learn how to transfer data from a selected table view cell to a separate detail view controller to display ...

Get iPhone and iPad App 24-Hour Trainer 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.