For the app I'm working on, what I'd like would be that when the view show, the pickerview view is already at a certain row, and that I don't need to touch it (unless I need it).I know there are plenty of question like this one on SO, but I couldn't find my answer.Right now here is what's done and what works:When the view appears, the UIPickerView is at the preselected row (ie 2nd for example)I can change it to another one and save it.But, when I try to save without touching it, it's like nothing is selected. I've to touche the PickerView to select the row I want, even if it's the one I "Selected" at first.I'm selected the row with :pickerViewAction.selectRow(inPickerViewAction.index(of: temp?[0] as! String)!, inComponent: 0, animated: true)WhereinPickerViewAction.index(of: temp?[0] as! String)!is the row I need.How I test if a row is selected (maybe my problem comes from here, I don't know...)let selectedValue1 = inPickerViewAction[Row]
switch selectedValue1 {
case "Email" :
// DOING MY STUFF
case "Commande http", name1, name2, name3, name4, name5:
//DOING MY STUFF
default: let alert = UIAlertController(title: "Nothing selected", message:"You must select an item before saving", preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
self.present(alert, animated: true, completion: nil) breakRight now if I don't touch the UIPickerView, I've the UIAlert that show.If anyone have an idea, that'd be great. Thanks