Protocol

UIPicker​View​Delegate

The delegate of a UIPicker​View 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.

Overview

The delegate implements the required methods of this protocol to return height, width, row title, and the view content for the rows in each component. It must also provide the content for each component’s row, either as a string or a view. Typically the delegate implements other optional methods to respond to new selections or deselections of component rows.

See UIPicker​View for a discussion of components, rows, row content, and row selection.

Symbols

Setting the Dimensions of the Picker View

func picker​View(UIPicker​View, row​Height​For​Component:​ Int)

Called by the picker view when it needs the row height to use for drawing row content.

func picker​View(UIPicker​View, width​For​Component:​ Int)

Called by the picker view when it needs the row width to use for drawing row content.

Setting the Content of Component Rows

The methods in this group are marked @optional. However, to use a picker view, you must implement either the picker​View(_:​title​For​Row:​for​Component:​) or the picker​View(_:​view​For​Row:​for​Component:​reusing:​) method to provide the content of component rows.

func picker​View(UIPicker​View, title​For​Row:​ Int, for​Component:​ Int)

Called by the picker view when it needs the title to use for a given row in a given component.

func picker​View(UIPicker​View, attributed​Title​For​Row:​ Int, for​Component:​ Int)

Called by the picker view when it needs the styled title to use for a given row in a given component.

func picker​View(UIPicker​View, view​For​Row:​ Int, for​Component:​ Int, reusing:​ UIView?)

Called by the picker view when it needs the view to use for a given row in a given component.

Responding to Row Selection

func picker​View(UIPicker​View, did​Select​Row:​ Int, in​Component:​ Int)

Called by the picker view when the user selects a row in a component.

Relationships

Inherits From