UIActionSheetDelegate
En el fichero .m
-(void)AbrirOpciones:(id)sender{
pickerViewPopup = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
UIPickerView *chPicker = [[UIPickerView alloc] initWithFrame:CGRectMake(0.0, 44.0, 0.0, 0.0)];
chPicker.dataSource = self;
chPicker.delegate = self;
chPicker.showsSelectionIndicator = YES;
[pickerViewPopup addSubview:chPicker];
[pickerViewPopup showInView:self.view];
[pickerViewPopup setBounds:CGRectMake(0,0,320, 464)];
UIToolbar *pickerToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
pickerToolbar.barStyle = UIBarStyleBlackOpaque;
[pickerToolbar sizeToFit];
}
#pragma mark - opcion sobre el video
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
NSLog(@"Hemos elegido la opcion %d",row);
switch (row) {
case 0:
[pickerViewPopup dismissWithClickedButtonIndex:1 animated:YES];
break;
case 1:
[pickerViewPopup dismissWithClickedButtonIndex:1 animated:YES];
break;
case 2:
[pickerViewPopup dismissWithClickedButtonIndex:1 animated:YES];
break;
default:
[pickerViewPopup dismissWithClickedButtonIndex:1 animated:YES];
break;
}
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
return 3;
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
switch (row) {
case 0:
return @"texto 1";
break;
case 1:
return @"texto 2";
break;
case 2:
return @"texto 3";
break;
default:
break;
}
return @"";
}
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 1;
}