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.
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.
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 ...