不调用UIImagePicker委托

时间:2014-05-26 11:44:46

标签: ios uiimagepickercontroller

我正在使用UIImage Picker但是没有调用委托。

- (IBAction)captureVideo:(id)sender {
    self.imgPicker = [[UIImagePickerController alloc] init];
    self.imgPicker.allowsImageEditing = YES;
    self.imgPicker.delegate = self;
    /* if we want from the library*/
    self.imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    self.imgPicker.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];

    [self performSelector:@selector(takePicture) withObject:self afterDelay:1.0];
// I added that after an answer I san on SO


}

-(void) takePicture
{
    [self presentModalViewController:self.imgPicker animated:YES];

}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)info {
    NSLog(@"Video chosen");
}

我添加了here中看到的延迟。

我在设备上运行。

1 个答案:

答案 0 :(得分:1)

首先,该方法在iOS 3.0中已弃用,请改为使用:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info

还要确保您的界面符合协议 <UIImagePickerDelegate>

相关问题