Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIImagePickerController iPad problems

I have the following code:

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] initWithRootViewController:self];
imagePicker.delegate = self;

popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
[imagePicker release];
[popover presentPopoverFromRect:CGRectMake(100, 100.0, 0.0, 0.0) 
                         inView:self.view
       permittedArrowDirections:UIPopoverArrowDirectionAny 
                       animated:YES];

But this only destroys the self.view and does not show anything at all. When I set the inView: to [self.view window] the picker at least shows up. But it still removes the self.view. What do I have to do that the view doesn't disappear?

like image 602
V1ru8 Avatar asked Jul 29 '10 10:07

V1ru8


2 Answers

You are initializing the UIImagePickerController wrong. Try changing it to

[[UIImagePickerController alloc] init]
like image 159
Bjarne Mogstad Avatar answered Sep 27 '22 23:09

Bjarne Mogstad


You are trying to show a popup inside a view with that view itself!

initWithRootViewController is the view(controller) to show inside the popup.

inview is the view where the popup will pop up

like image 25
Bruno D. Rodrigues Avatar answered Sep 27 '22 23:09

Bruno D. Rodrigues