How to create two linked spinners in SWIFT

0

I have two spinners linked in Android and they work without problems, but I do not know how to replicate them in SWIFT ... Does anyone know how to do it or what is the tool called?

I have seen some videos from pickerview and dropdownmenu but I have not seen any that link to two of them. That is, if I choose a Country X, I want the cities of that Country X to appear in the other spinner ...

I hope you can help me, from now, thank you very much.

    
asked by Matías Nicolás Núñez Rivas 05.12.2018 в 02:09
source

1 answer

0

Use Interface Builder to add the wheels (UIPicker) and then create an @IBOutlet to the view controller to control it with code. The Apple page specifies the methods you can use to see which row is selected, selectedRow on the one hand; and on the other hand to change the elements of the wheel, with the dataSource property and the reloadComponent method.

Now, you can use the same UIPicker with the two fields you need, the most advisable, or put two different fields in one.

From here the code is practically making a switch for each country. If you have any questions, do not hesitate to consult it.

Greetings.

    
answered by 19.12.2018 в 02:23