20

Is there a way to make the UIPickerView 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.

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
erastusnjuki
  • 1,491
  • 3
  • 14
  • 32
  • For the Swift version, see [How to disable UIPickerView (Swift)?](https://stackoverflow.com/q/41796806/2745495). – Gino Mempin Aug 08 '20 at 02:01

3 Answers3

37

Set the picker's userInteractionEnabled to NO.

kennytm
  • 510,854
  • 105
  • 1,084
  • 1,005
26

Use this to make it not interactable

[pickerObj setUserInteractionEnabled:NO];

and this to

[pickerObj setAlpha:.6];

fade the opacity so it looks non-interactable

hcwiley
  • 261
  • 3
  • 3
3

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

Chris Amelinckx
  • 4,334
  • 2
  • 23
  • 21