iOS Reference Library Apple Developer
Search

TableViewSuite

Last Revision:
Version 2.4, 2010-06-24
Upgraded project to build with the iOS 4 SDK, fixed NSTimeZoneWrapper parsing bug, replaced use of deprecated "addTimeInterval".
(Full Revision History)
Build Requirements:
iOS 4.0 SDK
Runtime Requirements:
iPhone OS 3.2 or later

This sample shows how to use UITableView through a progression of increasingly advanced applications that display information about time zones.

The first example shows a simple list of the time zone names. It shows how to display a simple data set in a table view.

The second example shows the time zones split into sections by region, with the region name as the section heading. It shows how to create an indexed table view.

The third example shows the time zones split into sections alphabetically, with the first letter of their locale name as the section heading. It shows how to set up a table view to display an index.

When implementing a table view cell, there's a tension between optimal scrolling performance and optimal edit/reordering performance. You should typically use subviews in the cell's content view.

When you have an edit or reordering control, using subviews makes the implementation easier, and the animations perform better because UIKit doesn't have to redraw during animations.

Subviews have two costs:

1) Initialization. This can be largely mitigated by reusing table cells. 2) Compositing. This can be largely mitigated by making the views opaque. Often, one translucent subview is fine, but more than one frequently causes frame drops while scrolling.

If the content is complex, however (more than about three subviews), scrolling performance may suffer. If this becomes a problem, you can instead draw directly in a subview of the table view cell's content view.

The fourth example displays more information about each time zone, such as the time and relative day in that time zone. Its main aim is to show how you can customize a table view cell using subviews. It also introduces custom classes to represent regions and time zones to help reduce the overhead of calculating the required information -- these are also used in the fifth example.

The fifth example is an extension of the fourth. It displays even more information about each time zone, such as the time and relative day in that time zone. Its shows how you can create a custom table view cell that contains a custom view that draws its content in -drawRect:.




Last updated: 2010-06-24

Did this document help you? Yes It's good, but... Not helpful...