Reputation: 3900
Return a custom view for the following method to customize the picker row:
public override func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView {
return PickerAccessoryView.instantiateFromNib()
}
and returning to be full width:
public func pickerView(_ pickerView: UIPickerView, widthForComponent component: Int) -> CGFloat {
return pickerView.frame.width
}
Does not resize the row view :O
Upvotes: 0
Views: 412
Reputation: 3900
Solved by setting the initial frame of the custom view to .zero:
public override func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView {
let view = PickerAccessoryView.instantiateFromNib()
view.frame = .zero
return view
}
Upvotes: 2