Reputation: 1041
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
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