Instance Method

pickerView:viewForRow:forComponent:reusingView:

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

Declaration

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view;

Parameters

pickerView

An object representing the picker view requesting the data.

row

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.

See Also

Setting the Content of Component Rows

- pickerView:titleForRow:forComponent:

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

- pickerView:attributedTitleForRow:forComponent:

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

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software