I can find a post that teach to use delegate method to check if the row valid and then scroll to the right one if not.
But that's not I want. Can I disable the specific row after the pickerView initialized? Like "Gray-out" the row and can't stop indicator on it.
Thank you, experts.
There are two parts to doing this.
-[<UIPickerViewDelegate> pickerView:viewForRow:forComponent:reusingView:]
to return a custom view for each row, such as a UILabel
. For the row you want to show up as disabled, you'll need to configure the view to reflect that disabledness.-[<UIPickerViewDelegate> pickerView:didSelectRow:inComponent:]
, you'll need to detect when the disabled is selected, and then use -[UIPickerView selectRow:inComponent:animated:]
to "rollback" to a "valid" row.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With