cameraOverlayView prevents editing with allowsEditing
Asked Answered
A

1

8

Editing a photo after it's been taken (moving and scaling it) works fine in my app with this line:

[imagePicker setAllowsEditing:YES];

But if I also use a cameraOverlayView, the editing mode doesn't work anymore. The screen comes up, but pan and pinch gestures don't make anything happen.

I'm using your average image picker controller:

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];

And I add a camera overlay view, created from a custom view controller's view:

CameraOverlayViewController *overlayController = [[CameraOverlayViewController alloc] init];
UIView *overlayView = overlayController.view;
[imagePicker setCameraOverlayView:overlayView];

In IB, that view is set up to enable user interaction and multiple touch, which allows it to zoom and focus while taking the picture. But once the picture is taken and it enters editing mode, you cannot pan or pinch to move or scale the photo.

What am I missing?

Anubis answered 16/4, 2012 at 16:43 Comment(2)
I am seeing the same issue here. and also the volume-control (shutter) button does not work neither after using the overlayEngraving
Use Billy's amazing tip, or #17942944Pomeroy
B
32

Does your overlay take up the entire space of the camera view? If so, touches are going to the overlay instead of the view below, even if you have a transparent background.

Add this method to your overlay view and it will ignore touches so that they are passed to the views below. (You are overriding a method of UIView that detects touches.)

- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
    return NO;
}

Note: as well as that fantastic tip, you may also want to use this piece of info, to remove your overlay view, at that stage: UIImagePicker cameraOverlayView appears on Retake screen

Branen answered 24/4, 2012 at 14:34 Comment(2)
Thanks. I'm not working on this feature anymore, so I haven't tested it on my own app, but I assume it's hunky-dory. Sorry I missed it earlier!Anubis
Tested, works. In iOS 7, my overlay view was also intercepting touches on the 'Use Photo' and 'Retake' buttons, and this fixed that.Paralyze

© 2022 - 2024 — McMap. All rights reserved.