Preselected options in UIPickerView when app starts SWIFT

Viewed 24

I am new at Swift and I need help. I have 4 UIPickerViews that have some data. Result ( that are combination of 4 ) is shown in Label. And everything is working smoothly, but what I want is, when the app starts there is some preselected values in those pickerviews that are not showing results before I manually change those values. When I start picking values I get results in Label. My question is how to show those results when the app starts with those preselected values?

1 Answers

This should probably do the trick:

yourPicker.selectRow(<index of item you want to select>, inComponent: 0, animated: true)

Also if the labels are not showing the correct text, then you can also do:

myLabel.text = yourPickerData[<index of item you want to select>]
Related