UIImagePickerController with OverlayView Camera on iPad iOS 6 Does Not Have a Take Photo Button

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

This works great on iOS 5, but on iOS 6 there is no “Take Photo” button, instead there is another switch between the front and rear cameras!

See the following screenshot -

missing take photo button

This code is 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 [picker.cameraOverlayView addSubview:libraryButton] , it works fine, but my custom button disappears (as expected).

So why does the purpose of cameraOverlayView change the bottom toolbar?

Any hint on how to bring back the “Take Photo” button on iOS 6?

+4
source share

Source: https://habr.com/ru/post/1434427/


All Articles