识别圆形手势以删除注释,如何检测圆? [英] Recognising a circle gesture to drop an annotation, how to detect circle?

查看:98
本文介绍了识别圆形手势以删除注释,如何检测圆?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了一些代码可以在视图中的任何位置检测到圆形手势:
http://iphonedevelopment.blogspot.com/2009/04/detecting-circle-gesture.html

I've found some code which detects a circle gesture anywhere in a view: http://iphonedevelopment.blogspot.com/2009/04/detecting-circle-gesture.html

一切正常。

现在我想将它合并到地图视图中,以便用户可以绘制一个圆圈,并且地图图钉会在绘制的圆圈中间掉落。如果我使用上面的代码将UIView子类化,并在其上粘贴地图,则上述代码不起作用。 (除非我隐藏地图)。如果我将代码放在子类化的MKMapView中,它也不会起作用。

Now I want to incorporate it into a map view, so that the user can draw a circle, and a map pin gets dropped in the the middle of the drawn circle. The above code doesn't work if I subclass a UIView, with the code above, and stick a map on it. (unless I hide the map). Neither does it work if I put the code in a subclassed MKMapView.

有没有办法将圆形识别器与地图合并?

Is there a way to incorporate the circle recogniser with a map?

推荐答案

回答我自己的问题:

此页面很有用: http://justinimhoff.com/swipe-gesture-with-uiwebview/

对于上面的圆圈示例,我将CircleView设置为UIGestureRecognizer而不是视图..在该文件中使用'self.view'更改了'self'的实例。然后我将它与滑动手势示例结合起来,确保将我的圆圈手势识别器的代表设置为自己。
如果有人需要了解更多详情,请与我们联系。

For the circle example above, I made CircleView a UIGestureRecognizer instead of a view.. changed instances of 'self' with 'self.view' within that file. Then I combined it with the swipe gesture example, making sure to set the delegate of my circle gesture recognizer to self. If anyone needs to know more details, let me know.

这篇关于识别圆形手势以删除注释,如何检测圆?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆