In my application, I added a cameraOverlayView
to the camerapicker. It contains three subviews, two UIButtons
and one UIImageView
. The image is draggable. The buttons are used to change the image to another one.
When I touch a button, or the image, the tap-to-focus rect of the camera will always be displayed beneath (and the actual focus will change). Setting exclusiveTouch
to YES
on all three subviews doesn't change the behaviour.
Any idea, how i can stop the camerapicker from getting the touches of my buttons / subviews of my overlayview (but still getting the touches for touch-to-focus, switching cameras etc.)?
To give some more information. I'm using the following code, to allow camera interaction while having an overlayview, which subviews still get the touches.
// CameraOverlayView.m
[...]
// ignore touches on this view, but not on the subviews
-(id)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
id hitView = [super hitTest:point withEvent:event];
if (hitView == self) return nil;
else return hitView;
}
There are a couple of ways to stop this that I found. None of the ways do exactly what I would like it to do. But tweaking it around should give you something usable.
1.) Disable camera control.
cameraPickerController.showsCameraControls = NO;
This will ultimately take down the touch to focus from the screen but it would take down other controls too.2.) Control the hitTest in your overlayView and set those area to nil. This solution is very awkward but it works for me.
This is my overlayView that manages a face mask
So if you get tweaking, this will work for you. I am still looking for the magic wand that make this work without all the hacks. No sign of it still :(