4

The following code creates a popover controller with a UIImagePickerController that uses cameraOverlayView to show a custom button that opens photo library.

This works great on iOS 5, but on iOS 6 the "Take Photo" button is missing, instead - there's another switch between front and back camera button!

See the following screenshot -

missing take photo button

This is the code - UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera;

if ( ![UIImagePickerController isSourceTypeAvailable: sourceType] ) {
    [self openLibrary: sender];
    return;
}

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

UIButton *libraryButton = [UIButton buttonWithType: UIButtonTypeCustom];
libraryButton.frame = CGRectMake(12, 12, self.photoLibraryIcon.size.width, self.photoLibraryIcon.size.height);
[libraryButton setImage: self.photoLibraryIcon forState: UIControlStateNormal];
[libraryButton addTarget: self action: @selector(openLibrary:) forControlEvents: UIControlEventTouchUpInside];

[picker.cameraOverlayView addSubview:libraryButton];

__imagePickerPopoverController = [[UIPopoverController alloc] initWithContentViewController: picker];
self.imagePickerPopoverController.delegate = self;

[self.imagePickerPopoverController presentPopoverFromRect: CGRectMake(self.center.x - 5, self.center.y - 5, 10, 10)
                                                   inView: self.superview
                                 permittedArrowDirections: UIPopoverArrowDirectionAny
                                                 animated: YES];

If I remove the [picker.cameraOverlayView addSubview:libraryButton], it works fine, but then my custom button will be gone (as expected).

So why assigning a cameraOverlayView changes the bottom toolbar?

Any clue on how to get the "Take Photo" button back to iOS 6?

Kof
  • 23,893
  • 9
  • 56
  • 81
  • Have you been able to solve this issue? I have same problem.Please check this question. I have this issue for iOS 7. Please let me know the updates, if any. http://stackoverflow.com/questions/20327218/camera-controls-not-visible-on-ios-7 – andy Dec 04 '13 at 10:46

0 Answers0