UIPicker array view

0

People, good night ... I have the following problem: I need to insert a picker view in my application, this picker view receives the data from an array, and when the user clicks a button it triggers an action that takes the value of the pickView (it can be up to the position in the array ) and changes the text of a label. I've tried several tutorials on the internet, but they all give a compilation problem, or when testing on the problem iphone when opening the view. Could someone please tell me a good tutorial well explained and that is working or could you show me how? Thanks

    
asked by anonymous 05.10.2015 / 02:59

1 answer

1

Since you already have UIPickerView defined and with the correct values, to get who is selected, if you only have one component, do so:

let selecionado: Int = pickerView.selectedRowInComponent(0)

And with the variable selecionado , you identify the array value to fill your UILabel .

    
05.10.2015 / 18:50