0

I'm using a UIPickerView, and it has the first value chosen by default. When the user doesn't move the UIPickerView from this initial selection, however, the value selected comes back as NSNull. How can I make it so either:

  1. The first value is recognized whether the user changes the selection or not.
  2. The UIPickerView contains a blank value that I can check for in the first spot.
muttley91
  • 12,278
  • 33
  • 106
  • 160

1 Answers1

0

You can use

[_picker selectedRowInComponent:0]

nil means no one move the picker (you can make the first item blank or sth like "--" )

Reference : https://stackoverflow.com/a/27058363/471840

Community
  • 1
  • 1
Ryan Wu
  • 5,963
  • 2
  • 36
  • 47