Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable particular row value in UIPickerView

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?

like image 537
Riddhi Shah Avatar asked Apr 19 '16 13:04

Riddhi Shah


1 Answers

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.

like image 180
Daniel Avatar answered Oct 03 '22 18:10

Daniel