Disable UIPickerView

2019-01-23 12:32发布

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.

3条回答
2楼-- · 2019-01-23 13:10

Set the picker's userInteractionEnabled to NO.

查看更多
混吃等死
3楼-- · 2019-01-23 13:10

Use this to make it not interactable

[pickerObj setUserInteractionEnabled:NO];

and this to

[pickerObj setAlpha:.6];

fade the opacity so it looks non-interactable

查看更多
Melony?
4楼-- · 2019-01-23 13:12

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

查看更多
登录 后发表回答