如何在UIActionSheet中添加UIPickerView [英] how to add UIPickerView in UIActionSheet
问题描述
我要输入评级(1-5)的值,所以我找到了以下日期选择器代码,有人可以帮我更改下面的代码,以便添加UIPickerView从1到5中选择速率
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];
操作方法将自动使用从UIPIckerView中选择的值输入评分文本字段
what to do so text field for ratings will auto entered with selected value from UIPIckerView
谢谢
推荐答案
首先,我认为您可能会将UIPickerView与UIDatePickerView混淆了.日期选择器是专门的选择器,在专门定制UIPickerView时无法对其进行自定义.马克·W(Marc W)在他的评论中是对的.我之前回答了这个问题,并认为它提供了一个比尝试将选择器添加到UIActionSheet更好的解决方案.
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.
那里有很多UIPickerView教程.
There are lots of UIPickerView tutorials out there.
这篇关于如何在UIActionSheet中添加UIPickerView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!