Chapter 6. Displaying Data Using Tables

WHAT'S IN THIS CHAPTER?

  • Displaying information in a table

  • Using tables for navigation

  • Taking advantage of UITableView's built-in editing features

  • Adding a search bar to a table

Most programmers visualize a "table" as a grid: a set of rows and columns used to display structured information similar to a spreadsheet. C#/.NET developers probably think of the DataGrid or GridView control in their area of expertise (WinForms, ASP.NET, or WPF).

Tables on the iPhone are a more like a Repeater control in ASP.NET, with an almost infinitely flexible ItemTemplate. The two key classes are UITableView and the UITableViewCell. Both are provided with useful default functionality and can be highly customized via either Interface Builder or in code to produce almost any structured content display you can imagine. Coupled with the UINavigationController to help manage multiple levels of navigation, the UITableView forms the basis for much of the iPhone OS UI that you are familiar with. Tables and how you use and manage them in the iPhone OS are what this chapter is all about.

Tables are used throughout the iPhone OS, from obvious places like the iPod Album/Artist/Track and Contact lists to the Messages application and the display/editing of values in Settings. Figure 6-1 shows a variety of different examples, highlighting how flexible and customizable the UITableView control can be.

Figure 6-1. FIGURE 6-1

The main classes required to create these user interfaces are ...

Get Professional iPhone® Programming with MonoTouch and .NET/C# 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.