Tables
Like the other views you’ve seen in this book, a table view (UITable)
holds information. A table view’s appearance, however, is slightly
counterintuitive. Instead of showing up as a true table (like an Excel
worksheet), a table view displays a single list of cells onscreen. Each
cell can be structured to contain multiple pieces of information but is
still a single unit. In addition, the cells can be broken into sections
so that the clusters of information can be communicated visually. You
might, for example, list computer models by manufacturers or models of
the Macintosh by year. Table views respond to touch events and allow the
user to easily scroll up and down through long lists of information and
select individual cells through the help of a table view controller (UITableViewController).
Types of Tables
There are two basic styles of table views: plain and grouped, demonstrated in Figures 1 and 2,
respectively. Plain tables lack the clear visual separation of sections
of the grouped tables but are frequently implemented with a touchable
index (like the iPhone contact list). Because of this, they are
sometimes called indexed tables. We will continue to refer to them by
the names (plain/grouped) designated in Interface Builder.
Navigation Controllers
Tables are a great tool for
displaying information in lists and enabling a user to choose from the
list. However, tables are rarely used on their own in an iPhone
application. More frequently, they are used in conjunction with a
navigation controller (UINavigationController).
Navigation controllers provide a simple means for users to drill down
through multiple views of data, as well as to return to where they
started.
You might recognize
navigation controllers from many other applications on the iPhone, such
as the Contacts application, where a group of individuals can be chosen,
then a specific person, and finally, individual contact details. At any
time, the user can click a button at the top of the view (the UINavigationBar) to return to the previous level of detail, as demonstrated in Figure 3.