PickerViewDelegate

@objc
public protocol PickerViewDelegate : AnyObject

This protocol provides the methods to customize a pickerview.

  • This method is called whenever the label for a row is needed.

    Note

    When there is no delegate, a standard UILabel object with center text alignment is used.

    Declaration

    Swift

    func makeLabel(_ pickerView: UIPickerView, text: String) -> UILabel

    Parameters

    pickerView

    The picker view requesting a label.

    text

    The text to be displayed on the label.

    Return Value

    A customized UILabel object having the specified text.

  • This optional method is called whenever the row width is needed.

    Declaration

    Swift

    @objc
    optional func rowWidth(_ pickerView: UIPickerView) -> CGFloat

    Parameters

    pickerView

    The picker view requesting this information.

    Return Value

    A custom value for the row width.

  • This optional method is called whenever the row height is needed.

    Declaration

    Swift

    @objc
    optional func rowHeight(_ pickerView: UIPickerView) -> CGFloat

    Parameters

    pickerView

    The picker view requesting this information.

    Return Value

    A custom value for the row height.