1

I have 2 apps that are using UIPickerViews, if the user does nothing (even though it appears the first row is selected) the app won't compute. I.e. if they want to choose the first row, they need to scroll down, then back and select the first row...not very intuitive. How can I set a default state so that if they choose nothing, the first row displayed is selected by default?

Thanks!

GarySabo
  • 5,806
  • 5
  • 49
  • 124

1 Answers1

1

I found the following from one of the older thread try the below

MyPicker.selectRow(row, inComponent: 0, animated: true)

Older thread

Community
  • 1
  • 1
chirag90
  • 2,211
  • 1
  • 22
  • 37
  • If this is a default value, you probably wont to set `animated` to `false` – Sulthan Mar 25 '15 at 15:59
  • Thanks, I realized that I phrased my question improperly. While above method works to set a default field as selected (so questioned answered), it's not "selected' for purposes of running the code after. What I need to do is either initialize a value or implement an if statement, i.e. if picker's value == nil { set a value} else { } – GarySabo Mar 25 '15 at 18:20