Instance Method


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


optional func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView



An object representing the picker view requesting the data.


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


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


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.


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.