How to create a custom Picker view controller in iPhone?

1.7k views Asked by At

I want to create a custom picker view controller. When user selects the particular data in the picker list, then will displayed the check mark image for selected category. How do i set the custom image as selected the category. I have created a label and displayed the contents are in the custom label. But i want to displayed the images only, when selects the category. I have searched for many docs and sample programs in the google. But i didn't get any clear idea. So please help me out.

see my screen shot

ScreenShot

Thanks.

2

There are 2 answers

0
Michael Kessler On BEST ANSWER

I think that using - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view as I have advised you in the chat room won't help you achieve this UI.

I think that you are better use a UITableView with no separators between cells and place an image above the table so that it will look like a picker.

The problem using a regular UIPicker here is that you want the selected row to move.
In the picker the selected row is the one that is located in the center...

0
Mitesh Khatri On

You should add custom view in picker control using below default method :

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view

{

}

Thanks