MkMapView触摸时放下一个引脚 [英] MkMapView drop a pin on touch
问题描述
我正在努力发掘一种基于触摸输入在MkMapView上放置引脚的标准方法。可能没有标准的方法,但总是值得一提。如果我必须自己实现这一点,那么添加手势识别器以便在地图视图上点按即可。
I am struggling to unearth a standard way to drop a pin on a MkMapView based on a touch input. There probably isnt a standard way, but it is always worth asking. If I have to implement this myself is the best approach to add a Gesture Recogniser to pick up a tap on the map view.
推荐答案
是的,您可以使用 UILongPressGestureRecognizer
来执行此操作。
Yes, you can use a UILongPressGestureRecognizer
to do this.
我之前的答案中包含示例代码的详细信息:
如何在触摸时将推针添加到MKMapView(IOS)?
This previous answer of mine has details with sample code:
How to add a push pin to a MKMapView(IOS) when touching?
在 viewForAnnotation <中为放置设置动画/ code>,返回
MKPinAnnotationView
, animatesDrop
设置为YES。
这篇关于MkMapView触摸时放下一个引脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!