Reputation: 1468
I would like to use UIImagePickerController
to take pictures and disabling the use of the zoom pinch function while not blocking the camera controls when I do a [picker addSubView:myOverlay]
. So I create the following "myOverlayView" class with the hope of intercepting all touches so that my UIImagePickerController
camera controls are not affected.
(per this tutorial: https://josee.me/2011/02/16/overlaying-the-iphone-camera-without-blocking-its-controls/)
// implement UIView Class...
@implementation myOverlayView : UIView
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self.opaque = NO;
self.backgroundColor = [UIColor clearColor];
}
return self;
}
- (BOOL)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
NSLog(@"hitTest....hit");
return nil;
}
@end
// Call Camera...
picker.delegate = self;
picker.allowsEditing = NO;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
myOverlayView *myOverlayView1 = [[myOverlayView alloc]init];
[picker.view addSubview:myOverlayView1];
[self presentViewController:picker animated:YES completion:NULL];
The hitTest:Event method gets hit and the zoom pinch still works after the overlay has been added. What am I missing?
Upvotes: 0
Views: 527
Reputation: 1051
Why don't you try the following: Add a UIPinchGestureRecognizer to your overlay, and set the *pinchGesture.cancelsTouchesInView = YES
? Haven't tried this, but should be able to intercept the pinching of the picker.
Upvotes: 2