CameraOverlayView prevents editing with allowEditing

Editing a photo after deleting it (moving and scaling) works fine in my application with this line:

[imagePicker setAllowsEditing:YES]; 

But if I also use cameraOverlayView, the editing mode no longer works. A screen appears, but gestures and gestures do nothing.

I use your average image selection controller:

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

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

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

In IB, this view is configured to enable user interaction and multiple touch, which allows him to scale and focus when shooting. But as soon as the image is taken and it enters the editing mode, you cannot pan or pin to move or zoom the photo.

What am I missing?

+8
ios camera uiimagepickercontroller editing camera-overlay
source share
1 answer

Does your overlay overlap the entire space of the camera? If so, touches touch 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 the strokes so that they appear in the view below. (You override the UIView method that detects touches.)

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

Note: like this fantastic tip, you can also use this piece of information to remove the overlay image at this point: The UIImagePickerOverlayView camera appears on the playback screen

+32
source share

All Articles