O'Reilly logo

iPhone SDK Programming: Developing Mobile Applications for Apple iPhone and iPod touch by Maher Ali

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Special-Purpose Views

In this chapter, we present several important subclasses of the UIView class. In Section 7.1, we discuss picker views and show how they can be used for item selection. In Section 7.2, we discuss progress views and also talk about activity indicator views. Section 7.3 presents text views used in displaying multiline text. In Section 7.4 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 Section 7.5. In Section 7.6, we discuss several aspects of web views.

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

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 change the contents of any component. To force a change in the contents of a specific component, change the underlying data model (e.g., the array) representing the values of the component and call the UIPickerView's method reloadComponent: passing in the component index. If you would like to change all the components, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required