我曾经使用触摸来专注于我的cameraOverlayView (在UIImagePickerController中),但一旦我更新到iOS 5,它就不能工作了。
我使用了一个自定义视图类,并将其应用于cameraOverlayView中的视图。我确保在Interface Builder中连接并应用了所有内容。我不想显示相机控件。(imagePicker.showsCameraControlls = NO)。
这是我在OverlayView类中的代码:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UIView * previewView = [[[[[[[[[[
self.picker.view // UILayoutContainerView
subviews] objectAtIndex:0] // UINavigationTransitionView
subviews] objectAtIndex:0] // UIViewControllerWrapperView
subviews] objectAtIndex:0] // UIView
subviews] objectAtIndex:0] // PLCameraView
subviews] objectAtIndex:0]; // PLPreviewView
[previewView touchesBegan:touches withEvent:event];
NSLog(@"Should Focus");
}你们在覆盖图上有不同的点击聚焦方法吗?
或者你知道怎么解决这个问题吗?
非常感谢你的提前!
发布于 2011-11-18 13:48:48
因为ios5.0Touch事件不会转发到UIImagePickerController的cameraOverlayView属性中的视图。
请按如下方式更改您的初始化代码:
// self.cameraOverlayView = [[UIView alloc] init];
// [self.cameraOverlayView addSubview:previewView];
[self.view addSubview:mask];
[self.view bringSubviewToFront:previewView];https://stackoverflow.com/questions/7984646
复制相似问题