UIImagePickerController
must be presented with UIPopoverController
on iPad.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker];
[popover presentPopoverFromRect:self.selectedImageView.bounds inView:self.selectedImageView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
self.popOver = popover;
} else {
[self presentModalViewController:picker animated:YES];
}
EDIT: Add a strong property for the UIPopoverController
:
@property (nonatomic, strong) UIPopoverController *popOver;
The popover should be dismissed in the delegate methods:
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…