在iPad中显示已保存的视频

时间:2013-07-19 07:11:45

标签: ios uiimageview uiimagepickercontroller

我想在popOver控制器的照片库中显示已保存的视频,就像图像一样。

如何在popOver控制器中显示视频?

我的图片代码如下:

if ([self.popoverController isPopoverVisible]) {
        [self.popoverController dismissPopoverAnimated:YES];
        [popoverController release];
    } else {
        if ([UIImagePickerController isSourceTypeAvailable:
             UIImagePickerControllerSourceTypeSavedPhotosAlbum])
        {
            UIImagePickerController *imagePicker =
            [[UIImagePickerController alloc] init];
            imagePicker.delegate = self;
            imagePicker.sourceType =
            UIImagePickerControllerSourceTypePhotoLibrary;
            imagePicker.mediaTypes = [NSArray arrayWithObjects:
                                      (NSString *) kUTTypeImage,
                                      nil];
            imagePicker.allowsEditing = NO;

            self.popoverController = [[UIPopoverController alloc]
                                      initWithContentViewController:imagePicker];

            popoverController.delegate = self;


            [self.popoverController presentPopoverFromRect:CGRectMake(100, 100, 150, 100) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

            [imagePicker release];

帮我解决这个问题。

谢谢,

1 个答案:

答案 0 :(得分:1)

您必须选择正确的mediaType:

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;

//here
imagePicker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil];
imagePicker.delegate = self;