我现在正在尝试实施一个应用,例如从设备相册中挑选图片和视频并将其上传到服务器..
在这里,我可以使用uiimagepickercontoller在表格视图中显示图像和视频,但我只能选择图像而不是视频..
如何使用UIimagepickercontroller选择视频表单照片库....
UIImagePickerController *ipc = [[UIImagePickerController alloc] init];
ipc.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
ipc.mediaTypes =[UIImagePickerController availableMediaTypesForSourceType:ipc.sourceType];
ipc.delegate = self;
ipc.editing = NO;
[self presentModalViewController:ipc animated:YES];
`
答案 0 :(得分:8)
检查docs并选择您需要的类型。
myImagePickerController.mediaTypes =
[[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
答案 1 :(得分:0)
在iPhone和iPad上验证和测试用于选择视频。
@property (strong,nonatomic) UIPopoverController *popOver;
属性设置为iPad访问。
UIImagePickerController *videoPicker=[[UIImagePickerController alloc] init];
videoPicker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
videoPicker.mediaTypes=[[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil];
videoPicker.delegate=self;
if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
UIPopoverController *popController=[[UIPopoverController alloc] initWithContentViewController:videoPicker];
[popController presentPopoverFromRect:CGRectMake(0, 600, 160, 300) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
self.popOver=popController;
}
else
{
[self presentViewController:videoPicker animated:YES completion:nil];
}