Chapter 8. Table Views and Collection Views
I’m gonna ask you the three big questions. — Go ahead. — Who made you? — You did. — Who owns the biggest piece of you? — You do. — What would happen if I dropped you? — I’d go right down the drain.
Dialogue by Garson Kanin and Ruth Gordon, Pat and Mike
A table view (UITableView) is a vertically scrolling UIScrollView (Chapter 7) containing a single column of rectangular cells. Each cell is a UITableViewCell, a UIView subclass. A table view has three main purposes:
- Information
-
The cells constitute a list, which will often be text. The cells are usually quite small, in order to maximize the quantity appearing on the screen at once, so the information may be condensed, truncated, or summarized.
- Choice
-
The cells may represent choices. The user chooses by tapping a cell, which selects the cell; the app responds appropriately to that choice.
- Navigation
-
The response to the user’s choosing a cell might be navigation to another interface.
An extremely common configuration is a master–detail interface, a navigation interface where the master view is a table view (Chapter 6): the user taps a table view cell to navigate to the details about that cell. This is one reason why the information in a table view cell can be a summary: to see the full information, the user can ask for the detail view.
In addition to its column of cells, a table view can have a number of other features:
-
A table can include a header view at the top and a footer ...
Get Programming iOS 11 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.