我正在使用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中看到的延迟。
我在设备上运行。
答案 0 :(得分:1)
首先,该方法在iOS 3.0中已弃用,请改为使用:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
还要确保您的界面符合协议 <UIImagePickerDelegate>
。