Disable particular row value in UIPickerView

五迷三道 提交于 2019-11-30 07:34:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!