spe
spe

Reputation: 1041

image picker appears momentarily on IPad

I have the following code:

UIImagePickerController* picker = [[UIImagePickerController alloc] init]; 
        picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
        picker.delegate = self; 

        popover = [[UIPopoverController alloc] initWithContentViewController:picker];
        popover.delegate = self;
        [popover presentPopoverFromRect:self.view.frame
                                 inView:self.view
               permittedArrowDirections:UIPopoverArrowDirectionAny
                               animated:YES];
        [picker release];

It should place an image picker dialog on screen in IPad. It works OK on simulator, but on device the picker appears momentarily and disappears.

Any ideas how to fix?

Upvotes: 0

Views: 796

Answers (1)

JayL
JayL

Reputation: 74

UIImagePickerController* picker = [[UIImagePickerController alloc] init]; 
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
picker.delegate = self; 
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker];
self.popoverController = popover;          
popoverController.delegate = self;
[self.popoverController presentPopoverFromBarButtonItem:sender
                               permittedArrowDirections:UIPopoverArrowDirectionAny 
                                               animated:YES];
[picker release];

Upvotes: 1

Related Questions