Apa*_*che 5 iphone uipickerview uiactionsheet
我有任务输入评级(1 - 5)值,所以我找到了以下代码的日期选择器,任何人都可以帮我改变下面的代码,以便添加UIPickerView选择从1到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];
Run Code Online (Sandbox Code Playgroud)
该做什么,所以评级的文本字段将自动输入UIPIckerView中的选定值
谢谢
sin*_*h99 13
actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
picker = [[UIPickerView alloc] initWithFrame:CGRectMake(0,40, 320, 216)];
picker.showsSelectionIndicator=YES;
picker.dataSource = self;
picker.delegate = self;
picker.tag=SelectedDropDown;
[actionSheet addSubview:picker];
UIToolbar *tools=[[UIToolbar alloc]initWithFrame:CGRectMake(0, 0,320,40)];
tools.barStyle=UIBarStyleBlackOpaque;
[actionSheet addSubview:tools];
[tools release];
UIBarButtonItem *doneButton=[[UIBarButtonItem alloc]initWithTitle:@"Done" style:UIBarButtonItemStyleBordered target:self action:@selector(btnActinDoneClicked)];
doneButton.imageInsets=UIEdgeInsetsMake(200, 6, 50, 25);
UIBarButtonItem *flexSpace= [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
NSArray *array = [[NSArray alloc]initWithObjects:flexSpace,doneButton,nil];
[tools setItems:array];
[doneButton release];
[flexSpace release];
//picker title
UILabel *lblPickerTitle=[[UILabel alloc]initWithFrame:CGRectMake(60,8, 200, 25)];
lblPickerTitle.text=@"";
lblPickerTitle.backgroundColor=[UIColor clearColor];
lblPickerTitle.textColor=[UIColor whiteColor];
lblPickerTitle.textAlignment=NSTextAlignmentCenter;
lblPickerTitle.font=[UIFont boldSystemFontOfSize:15];
[tools addSubview:lblPickerTitle];
[actionSheet showFromRect:CGRectMake(0,480, 320,215) inView:self.view animated:YES];
[actionSheet setBounds:CGRectMake(0,0, 320, 411)];
[actionSheet release];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
33149 次 |
| 最近记录: |