-1

我有一个 iPad 应用程序,当我单击按钮时,它会打开一个带有 iPad 库的弹出窗口以查看照片和图片。我希望当我单击按钮时它也应该显示视频,但它不显示视频。

在设备中,当我看到库时它会显示视频,但是当弹出窗口在应用程序中打开时,它不会显示任何视频。

UIImagePickerController *pckrImage = [[UIImagePickerController alloc] init];
pckrImage.delegate = self;
if (isiPhone) {
  if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypePhotoLibrary])   {
     pckrImage.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
     [self presentModalViewController:pckrImage animated:YES];
  }
}
else {
  popOver = [[UIPopoverController alloc]initWithContentViewController:pckrImage];
  [popOver presentPopoverFromRect:CGRectMake(450.0f, 825.0f, 10.0f, 10.0f) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
}    
4

1 回答 1

0

首先创建普通弹出框,然后将此代码添加到按钮“从图库中选择照片”

UIImagePickerController *imagePicker1 = [[UIImagePickerController alloc] init];
imagePicker1.contentSizeForViewInPopover=CGSizeMake(300, 200);
imagePicker1.delegate = self;
imagePicker1.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

Popcontroller = [[UIPopoverController alloc] initWithContentViewController:imagePicker1];
[Popcontroller presentPopoverFromRect:cell1.ButtonAddPicture.frame
                               inView:cell1.ButtonAddPicture.superview
             permittedArrowDirections:UIPopoverArrowDirectionUp
                             animated:YES];

对于视频,在上面的代码中添加以下行

imagePicker1.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];
于 2013-09-10T11:12:25.943 回答