Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extra "ghostly" camera button when using UIImagePickerController

On a communityapp development, I have the task of making an iPhone app into an iPad app.

Following the documentation, I used the following code to spawn my camera view :

    if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        self.imagePickerController = [[UIImagePickerController alloc] init];
        self.imagePickerController.delegate = self;
        self.imagePickerController.sourceType = sourceType;
        if (sourceType == UIImagePickerControllerSourceTypeCamera) {
            if ([UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront]) {
                self.imagePickerController.cameraDevice =  UIImagePickerControllerCameraDeviceFront;
            }
            self.imagePickerController.allowsEditing = YES;
            self.imagePickerController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
        }

        popover = [[UIPopoverController alloc] initWithContentViewController:self.imagePickerController];
        [popover presentPopoverFromRect:self.profilePicture.frame
                                 inView:self.view
               permittedArrowDirections:UIPopoverArrowDirectionAny
                               animated:YES];
        return;
    }

But when spawned, I get this annoying "extra ghostly" camera button...

This button is NOT welcome...

It doesn't work, and seems only to taunt me.

If I ask the object to hide its input buttons, ALL buttons disappear. I see no way of being able to tell that specific button to sod off.

UPDATE

I discovered it's only there the first time. If I close and reopen the popover, it's gone...

like image 241
Nils Munch Avatar asked Jul 23 '13 08:07

Nils Munch


Video Answer


1 Answers

Sadly, this appears to be a bug in iOS 6 itself. There are a few possible workarounds, however.

You can set the showsCameraControls property of the image picker to false. This will remove the ghostly image, but, the other controls will be removed as well. You'll have to write your own view with buttons and whatnot to call the correct actions.

You say if you close and reopen the popover, the button goes away. It may be possible for you to set the showsCameraControls property of the picker to false, and then back to true before the picker is displayed. If it doesn't work, try creating a sort-of fake open/close action when the picker is initialized.

like image 180
eswick Avatar answered Sep 20 '22 22:09

eswick