Class

UIPickerView

A view that uses a spinning-wheel or slot-machine metaphor to show one or more sets of values.

Declaration

@interface UIPickerView : UIView

Overview

A picker view displays one or more wheels that the user manipulates to select items. Each wheel—known as a component—has a series of indexed rows representing the selectable items. Each row displays a string or view so that the user can identify the item on that row. Users select items by rotating the wheels to the desired values, which align with a selection indicator.

You provide the data to be displayed in your picker view using a picker data source—an object that adopts the UIPickerViewDataSource protocol. Use your picker view delegate—an object that adopts the UIPickerViewDelegate protocol—to provide views for displaying your data and responding to user selections.

Topics

Providing the Picker Data

dataSource

The data source for the picker view.

UIPickerViewDataSource

The UIPickerViewDataSource protocol must be adopted by an object that mediates between a UIPickerView object and your application’s data model for that picker view. The data source provides the picker view with the number of components, and the number of rows in each component, for displaying the picker view data. Both methods in this protocol are required.

Customizing the Picker Behavior

delegate

The delegate for the picker view.

UIPickerViewDelegate

The delegate of a UIPickerView object must adopt this protocol and implement at least some of its methods to provide the picker view with the data it needs to construct itself.

Getting the Dimensions of the View Picker

numberOfComponents

Gets the number of components for the picker view.

- numberOfRowsInComponent:

Returns the number of rows for a component.

- rowSizeForComponent:

Returns the size of a row for a component.

Reloading the View Picker

- reloadAllComponents

Reloads all components of the picker view.

- reloadComponent:

Reloads a particular component of the picker view.

Selecting Rows in the View Picker

- selectRow:inComponent:animated:

Selects a row in a specified component of the picker view.

- selectedRowInComponent:

Returns the index of the selected row in a given component.

Returning the View for a Row and Component

- viewForRow:forComponent:

Returns the view used by the picker view for a given row and component.

Managing the Appearance of the Picker View

showsSelectionIndicator

A Boolean value that determines whether the selection indicator is displayed.

Deprecated

Relationships

Inherits From

Conforms To

See Also

Content Views

UIActivityIndicatorView

A view that shows that a task is in progress.

UIImageView

An object that displays a single image or a sequence of animated images in your interface.

UIProgressView

A view that depicts the progress of a task over time.

UIWebView

A view that embeds web content in your app.

Deprecated