这一个也得到了我之前。如果您在iPad上指定源类型UIImagePickerControllerSourceTypePhotoLibrary
或UIImagePickerControllerSourceTypeSavedPhotoAlbum
,则需要使用弹出式控制器来呈现图像选取器控制器。如果您尝试以模态方式呈现它,就像您正在做的那样,您会得到一个异常。
不是100%必需的,但使用测试来查看可用的源类型也是一个好主意。
[UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]
源类型:
UIImagePickerControllerSourceTypePhotoLibrary
UIImagePickerControllerSourceTypeSavedPhotosAlbum
UIImagePickerControllerSourceTypeCamera
这是我如何解决这个问题,以测试它是否是一个iPad与否。
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
UIPopoverController* popOverController = [[UIPopoverController alloc] initWithContentViewController:imagePickerController];
[popOverController presentPopoverFromRect:selectVideoToViewButton.bounds inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}else {
[self presentModalViewController:self.imagePickerController animated:YES];
}
是的,在文档概要的音符步骤4 - > http://developer.apple.com/library/ios/#documentation/uikit/reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html – borrrden 2012-08-03 01:03:15