views:

227

answers:

1

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?

+2  A: 

You are initializing the UIImagePickerController wrong. Try changing it to

[[UIImagePickerController alloc] init]
Bjarne Mogstad
Thx, I must have been blind!
V1ru8