Chapter 8. Special-Purpose Views

This chapter presents several important subclasses of the UIView class. In Section 8.1, we discuss picker views and show how they can be used for item selection. In Section 8.2, we discuss progress views and also talk about activity indicator views. Next, Section 8.3 shows how to use scroll views in order to display large (greater that 320 × 480) views. Section 8.4 presents text views used in displaying multiline text. In Section 8.5 we show how to use alert views for the display of alert messages to the user. Similar to alert views are action sheets which are discussed in Section8.6. In Section 8.7, we discuss several aspects of web views. Finally, we provide a summary in Section 8.8.

Picker View

The UIPickerView class can be used for giving the user a fancy way to select an item from a set of values. The class allows you to have multiple sets of values where each set is represented by a wheel (see Figure 8.1 for an example). The user spins the wheel in order to select a specific value from a given set. The values in a given set can be views (such as instances of UILabel, UIImageView, etc.) or strings.

An example of a picker view.

Figure 8.1. An example of a picker view.

Each wheel is a graphical representation of a component. Components are numbered starting from 0. Each component contains rows (i.e., the set of values). Rows are also numbered starting from 0.

You can dynamically ...

Get iPhone SDK 3 Programming: Advanced Mobile Development for Apple iPhone and iPod touch 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.