I figured out how to program 2 pickerView in one class (see the answer to the question).

Now I would like to understand how to change the data array in the second pickerView2 , depending on the selected row in the first - there is one main array and 4 "dependent" ones. It is necessary when selecting the zero line (first) in the first pickerView1 to issue one array in PickerView2 , the first (second) in PickerView1 to issue the second in pickerView2 , and so two more times.

I don’t know how to do it yet, but I suspect that the func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) function func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) is responsible for this, but I don’t understand how to describe these “processes”. I would be grateful if someone can help you figure it out.

  • It is difficult to understand exactly what you want, but approximately I can prompt you, select a line in PikerView1, then, depending on your needs, update the array (datasource) of your PikerView2 and update PikerView2 self.pickerView2l.reloadAllComponents (); This is the basic idea, the implementation algorithm is yours :) - Vitali Eller
  • Thanks, helped! - Igor Zexyy

0