How can I check the box next to UIPickerView shortcuts?

The UIPickerView that appears in Safari has a checkbox next to the current selection. Is there a built-in way to get this, or should I program it myself? If I need to create it, can someone tell me some code for this? Thanks check mark or tick

+7
source share
2 answers

You need to implement -pickerView:viewForRow:forComponent:reusingView: from UIPickerViewDelegate.

You need to create a view containing a UIButton with a checkmark image and return it from -pickerView:viewForRow:forComponent:reusingView:

+1
source

Here is an example of an official example for setting up a UIPicker view: http://developer.apple.com/library/ios/#samplecode/UICatalog/Introduction/Intro.html

In particular, refer to the PickerViewController classes. {h, m}, CustomPickerDataSource. {h, m} and CustomView. {h, m} in the example. You can create a similar custom UIPickerView with a tick image that appears only on the left for the selected item and changes the text color of the selected item. Also, be sure to set myPickerView.showsSelectionIndicator = NO; to remove the translucent panel above the selected item.

+5
source

All Articles