gpt4 book ai didi

ios - 如何禁用缩放并保留对 UIImagePickerController 的控制?

转载 作者:行者123 更新时间:2023-11-28 21:29:11 28 4
gpt4 key购买 nike

我想使用 UIImagePickerController 拍照并禁用缩放缩放功能,同时在我执行 [picker addSubView:myOverlay] 时不阻塞相机控件>。因此,我创建了以下“myOverlayView”类,希望拦截所有触摸,以便我的 UIImagePickerController 相机控件不受影响。

(根据本教程: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];

hitTest:Event 方法被命中,并且在添加叠加层后缩放缩放仍然有效。我错过了什么?

最佳答案

为什么不尝试以下操作:将 UIPinchGestureRecognizer 添加到叠加层,并设置 *pinchGesture.cancelsTouchesInView = YES?没试过这个,但是应该可以拦截 picker 的捏。

关于ios - 如何禁用缩放并保留对 UIImagePickerController 的控制?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36852537/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com