I am trying access the Photo Library from an iPad application. It is said that "On iPad, UIImagePickerController must be presented via UIPopoverController". That's exactly the log message that I get too.
Here is a snapshot of my app:
Since I am already listing the options via a popover, it doesn't make sense to go another popover from within. The accessPhotoLibrary method gets called when the user taps on the "Photo Library" cell.
-(void)accessPhotoLibrary{
NSLog(@"Photo library access requested!");
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]){
NSLog(@"Photo Library");
[imagePickerController setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[imagePickerController setDelegate:self];
[imagePickerController setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentViewController:imagePickerController animated:YES completion:nil];
}
else{
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle: @"Photo Library"
message: @"Sorry, couldn't open your photos library"
delegate: nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
}
But how do I get around this problem of having to access the photo library using a popover when I am using one already??
Any help is much appreciated.
UIPopoverController
for the image picker (if it's for the photo library - the camera should be in a full screen modal view controller). Do not reuse the little popover used for the options. BTW - why not use aUIActionSheet
for the options? – rmaddyUIImagePickerController
must be in aUIPopoverController
on the iPad if the image picker is not for the camera. – rmaddyUIModalPresentationFullScreen
toUIModalPresentationCurrentContext
since you are already in a popover. – rmaddy