Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Monotouch: How can I set the selected item(s) in a UIPickerView?

I've successfully created a UIPickerView and am using a custom ListModel tu supply the selectable items. But how can I specify which of the items should be selected when the view appears?

Thanks,

Adrian

like image 266
Adrian Grigore Avatar asked Jul 27 '11 12:07

Adrian Grigore


1 Answers

You have to call the picker view's Select method:

pickerView.Select(1, 0, true);

This will select the second row (index 1) of the first component (index 0). The boolean is for animating the selection or not.

See the documentation.

like image 90
Dimitris Tavlikos Avatar answered Nov 15 '22 21:11

Dimitris Tavlikos