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

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.

Parameters

A zero-indexed number identifying a row of component. Rows are numbered top-to-bottom.

component

A zero-indexed number identifying a component of pickerView. Components are numbered left-to-right.

Return Value

The string to use as the title of the indicated component row.

Discussion

If you implement both this method and the pickerView:attributedTitleForRow:forComponent: method, the picker view prefers the pickerView:attributedTitleForRow:forComponent: method. However, if that method returns nil, the picker view falls back to using the string returned by this method.

Parameters

A zero-indexed number identifying a row of component. Rows are numbered top-to-bottom.

component

A zero-indexed number identifying a component of pickerView. Components are numbered left-to-right.

Return Value

The attributed string to use as the title of the indicated component row.

Discussion

If you implement both this method and the pickerView:titleForRow:forComponent: method, the picker view prefers the use of this method. However, if your implementation of this method returns nil, the picker view falls back to using the string returned by the pickerView:titleForRow:forComponent: method.

Parameters

A zero-indexed number identifying a row of component. Rows are numbered top-to-bottom.

component

A zero-indexed number identifying a component of pickerView. Components are numbered left-to-right.

view

A view object that was previously used for this row, but is now hidden and cached by the picker view.

Return Value

A view object to use as the content of row. The object can be any subclass of UIView, such as UILabel, UIImageView, or even a custom view.

Discussion

If the previously used view (the view parameter) is adequate, return that. If you return a different view, the previously used view is released. The picker view centers the returned view in the rectangle for row.