MkMapView触摸时放下一个引脚 [英] MkMapView drop a pin on touch

查看:120
本文介绍了MkMapView触摸时放下一个引脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力发掘一种基于触摸输入在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屋!

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