在我的应用中,我需要有一个相机叠加,以帮助用户正确排列图片,以满足其预期用途。此外,我需要使用编辑界面让它们使用此“指南”微调变焦和对齐。我已经使用相机覆盖层来使用默认的相机控件(除非您使用默认控件,否则编辑窗格甚至不显示),但是现在在编辑屏幕上,我无法缩放/平移。触摸事件似乎发生在叠加层上,而不是编辑屏幕上。我知道/知道这是一个潜在的问题,并已实施了here
提到的修复这样可以专注于相机屏幕本身,您可以看到覆盖中正在通过/忽略的触摸,但在编辑屏幕上仍然无法正常工作。我还尝试了一些找到的最热门代码here
每次没有'UIViewController'的可见@interface声明超级线上的选择器'hitTest:withEvent:'时,该解决方案给我一个错误。
我还尝试过使用userInteractionEnabled属性的各种设置
以下是我用来进行叠加的代码:
self.picker = [[UIImagePickerController alloc] init];
self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
self.picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
self.picker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
self.picker.showsCameraControls = YES;
self.picker.navigationBarHidden = YES;
self.picker.toolbarHidden = YES;
self.picker.wantsFullScreenLayout = YES;
self.picker.allowsEditing = YES;
self.picker.view.userInteractionEnabled = YES;
// Insert the overlay
self.overlay = [[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil];
self.overlay.pickerReference = self.picker;
self.picker.cameraOverlayView = self.overlay.view;
[self.picker.cameraOverlayView setUserInteractionEnabled:YES];
//[self.picker.cameraOverlayView setUserInteractionEnabled:FALSE];
self.picker.delegate = self.overlay;
// [self performSelector:@selector(moveOverlayViewToSublayer :) withObject:self.picker afterDelay:0.1f];
[self presentModalViewController:self.picker animated:NO];
答案 0 :(得分:0)