Disable UIPickerView

南楼画角 提交于 2019-12-18 03:05:39

问题


Is there a way to make the UIPickerView only Read Only? This means that the user cannot flip through the options.

PS. This is not the same as not passing anything in the didSelectRow method because I only want the user to see that the picker is there and not to touch it.


回答1:


Set the picker's userInteractionEnabled to NO.




回答2:


Use this to make it not interactable

[pickerObj setUserInteractionEnabled:NO];

and this to

[pickerObj setAlpha:.6];

fade the opacity so it looks non-interactable




回答3:


If you are using a UIPickerView associated with a UITextField, just set the text field's isEnabled property to false.



来源:https://stackoverflow.com/questions/2377692/disable-uipickerview

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