views:

1475

answers:

1

hi expert, i'm having task to enter rating(1 - 5) value, so i found the below code for date picker, can anyone help me to alter below code so to add UIPickerView to choose rate from 1 to 5

UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"Ratings" 
                                              delegate:self
                                     cancelButtonTitle:@"Cancel"
                                destructiveButtonTitle:nil
                                     otherButtonTitles:nil];

UIDatePicker *pickerView = [[UIDatePicker alloc] init];
pickerView.datePickerMode = UIDatePickerModeDate;

[menu addSubview:pickerView];
[menu showInView:self.view];   
[menu sendSubviewToBack:pickerView];     
[menu setBounds:CGRectMake(0,0,320, 500)];

CGRect pickerRect = pickerView.bounds;
pickerRect.origin.y = -100;
pickerView.bounds = pickerRect;

[pickerView release];
[menu release];

what to do so text field for ratings will auto entered with selected value from UIPIckerView

thanks

+2  A: 

First of all, I think you might be confusing a UIPickerView with a UIDatePickerView. The date picker is a specialized picker that can't be customized while a UIPickerView is made specifically to be customized. Marc W is right in his comment. I answered this question before and feel it offers a better solution than trying to add the picker to the UIActionSheet.

There are lots of UIPickerView tutorials out there, so I would start by taking a look at one of those.

Best regards,

Matt Long