Adrian Grigore
Adrian Grigore

Reputation: 33318

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

Upvotes: 8

Views: 3812

Answers (1)

Dimitris Tavlikos
Dimitris Tavlikos

Reputation: 8170

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.

Upvotes: 19

Related Questions