Table views are commonly found in iPhone applications, especially productivity applications. They are versatile user-interface objects that you can adapt for different needs. A table presents a scrollable list of items (or rows) that may be divided into sections. Each row may display strings, images, or other identifiers of the represented data item. Users can select a row in a table and, as a result, be presented with another table view that lists items related to the item selected in the first table view. They might also be presented with a table view that presents details about an item. In this manner, table views are ideal mechanisms for traversing hierarchies of data. You can also use table views as indexed lists, enabling quick access of items by their index designation, and as lists of options, thus simulating a pop-up list or set of radio buttons on a desktop system.
Table View Programming Guide for iPhone OS explains the concepts underlying table-view programming and shows how to create and manage table views in your own projects. It starts by giving an overview of table styles and characteristics, as well as the programmatic interfaces related to table views. It also explains in general terms how to map collections of data at various levels of a hierarchical data model to sequences of table views, and how to use certain UIKit classes to support this traversal of a data hierarchy. After giving the conceptual background, the guide discusses various aspects of table view programming, such as creating and configuring table views, customizing table-view cells, managing selections, and inserting, deleting, and moving rows in a table view.
This book has the following chapters:
“About Table Views” provides an overview of table view characteristics and when you might use them.
“Overview of the Table View API” introduces the classes used to present table views in your application.
“Navigating a Data Hierarchy With Table Views” describes the how you map a hierarchy of data to table views in a navigation-based application and how to use the navigation-controller architecture and table-view controllers when implementing such applications.
“Creating and Configuring a Table View” describes the approaches for creating and configuring table views in your user interface.
“A Closer Look at Table-View Cells” describes cell objects, how to prepare their content for a table view, and how you can customize them for your application
“Managing Selections” describes how you manage selections in a table view.
“Inserting and Deleting Rows and Sections” explains how you manage the insertion and deletion of rows by the user.
“Managing the Reordering of Rows” describes how rows are reordered by the user and how you keep track of those changes.
Before reading this book, you should read iPhone Application Programming Guide to understand the basic process for developing iPhone applications. You should also consider reading View Controller Programming Guide for iPhone OS for general information about view controllers and for more detailed information about navigation controllers, which are frequently used in conjunction with table views.
You will find the following sample-code projects to be instructive models for your own table view implementations:
TableViewSuite project
TheElements project
SimpleDrillDown project
Last updated: 2009-08-19