Pugalmuni
Pugalmuni

Reputation: 9390

How to create a custom Picker view controller in iPhone?

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.

Upvotes: 2

Views: 1758

Answers (2)

Michael Kessler
Michael Kessler

Reputation: 14235

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...

Upvotes: 1

Mitesh Khatri
Mitesh Khatri

Reputation: 3955

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

Upvotes: 1

Related Questions