Does the camera shutter appear in front of a custom UIView?

I have a custom UIView that I created to display custom buttons and toolBar. When I first called him to show, the bar is on top of the shutter (which is good). But after the camera is loaded, a shutter appears in front of it, then it opens.

If you look at native camera.app, it will not. The toolbar stays there all the time. Here is my code:

// .h UIImagePickerController *theCamera; @property (nonatomic, retain) UIImagePickerController *theCamera; // .m theCamera = [[UIImagePickerController alloc] init]; theCamera.delegate = self; theCamera.sourceType = UIImagePickerControllerSourceTypeCamera; theCamera.showsCameraControls = NO; theCamera.toolbar.alpha = 0; theCamera.navigationBarHidden = YES; theCamera.toolbarHidden = YES; theCamera.wantsFullScreenLayout = YES; theCamera.cameraViewTransform = CGAffineTransformMakeScale(1.25, 1.25); UIImageView *tabBarBack = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tab_bar_back.png"]]; tabBarBack.frame = CGRectMake(0, 422, 320, 58); [customView addSubview:tabBarBack]; theCamera.cameraOverlayView = customView; [self presentModalViewController:theCamera animated:YES]; 

Obviously there are more buttons that I add to customView , but you get the concept.

+3
source share
3 answers

AFAIK there is no direct way to do this. If you use cameraOverlay, you will get a shutter for full screen.
Whatever the alternative methods (a game with a hierarchy of views) that will help you make the preview screen as a parent. I am not sure if this approach matches the recommendations of the app store.
see Hide / show iris / shutter animations for iPhone iPhone for a better understanding of how to achieve this.

0
source

Subscribe to:

 AVCaptureSessionDidStartRunningNotification 

This is when aperture animation begins. If you add CameraOverlayView during this time, it will be properly closed by the iris. It is published at the same time as this private PL notification .... This is a documented approach that does not compromise application rejection.

+1
source

In iOS 6+, if you added your controller as a delegate to the UIImagePickerController, this code should ensure that the shutter remains behind your camera. Overlayview:

 - (void) navigationController:(UINavigationController*) navigationController willShowViewController:(UIViewController*) viewController animated:(BOOL) animated { self.imagePickerController.cameraOverlayView = ...; // your camera overlay view } 

I have not tested on versions of iOS prior to iOS 6.

0
source

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


All Articles