RSDChoicePickerView

open class RSDChoicePickerView : UIPickerView, RSDPickerViewProtocol, UIPickerViewDataSource, UIPickerViewDelegate, RSDViewDesignable

RSDChoicePickerView is a UIPickerView that can be used to represent a picker with an associated index path. This picker has a RSDChoicePickerDataSource as it’s source. This implementation only supports text choices.

  • The observer of this picker

    Declaration

    Swift

    public weak var observer: RSDPickerObserver?
  • The index path associated with this picker.

    Declaration

    Swift

    public var indexPath: IndexPath!
  • The picker view data source for this view. This is a strong reference.

    Declaration

    Swift

    public var pickerSource: RSDChoicePickerDataSource!
  • Default initializer.

    Declaration

    Swift

    public init(pickerSource: RSDChoicePickerDataSource, indexPath: IndexPath)

    Parameters

    pickerSource

    The picker source used to set up the picker.

    indexPath

    The index path associated with this picker.

  • Required initialized.

    Declaration

    Swift

    public required init?(coder aDecoder: NSCoder)
  • The answer maps to the values for the selected rows.

    Declaration

    Swift

    public var answer: Any? { get set }
  • Returns true if the picker source has a separator between fields.

    Declaration

    Swift

    open var hasSeparator: Bool { get }
  • Returns the row offset for the picker source. By default, this equals 1 to allow showing an empty row, unless there is a non-nil default answer in which case this will return 0.

    Declaration

    Swift

    open var rowOffset: Int { get }
  • Override super to return the number of components returned by the picker source because this is the UIPickerViewDataSource for itself and therefore calling this method can cause returning 0 or an infinite loop of wacky madness.

    Declaration

    Swift

    open override var numberOfComponents: Int { get }
  • Override super to return the number of rows for each component returned by the picker source because this is the UIPickerViewDataSource for itself and therefore calling this method can cause returning 0 or an infinite loop of wacky madness.

    Declaration

    Swift

    open override func numberOfRows(inComponent component: Int) -> Int
  • Returns the choice associated with the given row.

    Declaration

    Swift

    open func choice(forRow row: Int, forComponent component: Int) -> RSDChoice?

    Parameters

    row

    The row in this picker view.

    component

    The component in this picker view.

  • returns the number of ‘columns’ to display.

    Declaration

    Swift

    open func numberOfComponents(in pickerView: UIPickerView) -> Int
  • returns the # of rows in each component.

    Declaration

    Swift

    open func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int
  • Returns the text value associated with the given row. If this is a separator, this will return the pickerSource.separator. Otherwise, this method will return the choice text for the choice returned by the picker.

    Declaration

    Swift

    open func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String?
  • Return a view to use for this picker. By default, this method returns a label that is aligned with the components center aligned.

    Declaration

    Swift

    open func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView
  • Returns the width of the component. By default, the width is calculated based on the width of the text.

    Declaration

    Swift

    open func pickerView(_ pickerView: UIPickerView, widthForComponent component: Int) -> CGFloat
  • Returns the height for the row. By default, the height of the largest component is used for all the components.

    Declaration

    Swift

    open func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat
  • Let the observer know that the picker value has changed.

    Declaration

    Swift

    open func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int)
  • Instantiate a label for the given component.

    Declaration

    Swift

    open func instantiateLabel(for component: Int) -> UILabel
  • Declaration

    Swift

    public private(set) var backgroundColorTile: RSDColorTile? {
      get
      }
  • Declaration

    Swift

    public private(set) var designSystem: RSDDesignSystem? {
      get
      }
  • Declaration

    Swift

    public func setDesignSystem(_ designSystem: RSDDesignSystem, with background: RSDColorTile)