问题
I am trying to disable particular row in pickerView.
I have an array of strings for pickerView. I am appending values in array1 when user selects particular row.
After that I want to do that when user again opens pickerView if array1 has values of array, pickerView's that value should be disabled.
How can I do that?
回答1:
Option 1: Disabling an element
You can give the title a greyed out style with the method pickerView:attributedTitleForRow:forComponent:
Then you can change to a defaut value when that item is selected using pickerView:didSelectRow:inComponent:
Option 2: Delete the item
The second option would be to just remove the item from the possible options by adjusting your datasource.
来源:https://stackoverflow.com/questions/36719508/disable-particular-row-value-in-uipickerview