我想在相机视图上绘制焦点指示器
我使用相机制作了一个应用程序。
我没有使用默认的相机工具栏。
因此,我在相机叠加视图上添加了一个工具栏。
我想绘制点击对焦指示器
所以我使用了 UITapGestureRecognizer。
这是代码
UITapGestureRecognizer *focusRect = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(drawFocusRect:)];
focusRect.numberOfTapsRequired = 1;
focusRect.numberOfTouchesRequired = 1;
[cameraPicker.view addGestureRecognizer:focusRect];
[focusRect release];
在drawFocusRect方法中
NSLog(@"tapped");
但这不起作用。
我更改了 numberOfTouchedRequired, 2 的值;
它有效。
我认为仅单击时它不起作用
那么,如何实现这种单击手势处理方法呢?
I made an application using the camera.
I didn't use the default camera toolbar.
So I add a toolbar on camera overlay view.
I want to draw tap to focus indicator
So I used UITapGestureRecognizer.
Here is the code
UITapGestureRecognizer *focusRect = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(drawFocusRect:)];
focusRect.numberOfTapsRequired = 1;
focusRect.numberOfTouchesRequired = 1;
[cameraPicker.view addGestureRecognizer:focusRect];
[focusRect release];
In the drawFocusRect method
NSLog(@"tapped");
But it dosen't work.
I changed the value of numberOfTouchedRequired, 2;
And it works.
I think that it doen't work when only single-tap
So, how can I implement this single tapping gesture processing method?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为相机视图的焦点视图位于所有视图的顶部。
我认为它具有单击操作。
所以如果你想这样做,你应该阅读 WWDC2010 中的 AVCamera demo。
I think camera view's focus view at top of all view.
And I think it has single tap action.
So If you want do this, you should read AVCamera demo in WWDC2010.