Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- actionSheet=[[UIActionSheet alloc] initWithTitle:@"" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
- [actionSheet showInView:self.view];
- UIToolbar *pickerToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0,480,32)];
- [pickerToolbar sizeToFit];
- pickerToolbar.barStyle = UIBarStyleBlackTranslucent;
- NSMutableArray *barItems = [[NSMutableArray alloc] init];
- UIBarButtonItem *cancelBtn = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonSystemItemCancel target:self action:@selector(cancel_clicked:)];
- [barItems addObject:cancelBtn];
- [cancelBtn release];
- UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
- [barItems addObject:flexSpace];
- [flexSpace release];
- UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(done_clicked:)];
- [barItems addObject:doneBtn];
- [doneBtn release];
- [pickerToolbar setItems:barItems animated:YES];
- [actionSheet addSubview:pickerToolbar];
- [barItems release];
- [pickerToolbar release];
- UIPickerView *picker = [[UIPickerView alloc] init];
- picker.frame = CGRectMake(0, 44, 320, 216);
- picker.delegate = self;
- picker.dataSource = self;
- picker.showsSelectionIndicator = YES;
- [actionSheet addSubview:picker];
- [picker release];
- -(void)done_clicked:(id)sender
- {
- [actionSheet dismissWithClickedButtonIndex:0 animated:YES];
- }
- -(void)cancel_clicked:(id)sender
- {
- [actionSheet dismissWithClickedButtonIndex:0 animated:YES];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement