简体   繁体   中英

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM