A view that uses a spinning-wheel or slot-machine metaphor to show one or more sets of values.
SDKs
- iOS 2.0+
- Mac Catalyst 13.0+
Framework
- UIKit
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.
Note
The UIDate
class uses a custom subclass of UIPicker
to display dates and times. To see an example, tap the add (“+”) button in the Alarm pane of the Clock app.
You provide the data to be displayed in your picker view using a picker data source—an object that adopts the UIPicker
protocol. Use your picker view delegate—an object that adopts the UIPicker
protocol—to provide views for displaying your data and responding to user selections.