首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >批注显示标注,而不是启动拖放操作

批注显示标注,而不是启动拖放操作
EN

Stack Overflow用户
提问于 2015-03-28 17:26:48
回答 1查看 271关注 0票数 2

我在iOS 8.x上使用Swift。我在我的地图(工具包)上有一些自定义图像的注释。现在,我希望用户能够使用拖放与引脚。这已经起作用了,但每次用户单击(并按住)注释时,将显示标注而不是拖动动画。在标注可见并再次单击注释后,我可以将其拖放到周围。

如果用户按下并按住注释,我如何才能更改行为,使其不显示标注,而是开始拖放?

谢谢

EN

回答 1

Stack Overflow用户

发布于 2015-03-28 17:39:29

在您的注释(mapView: MKMapView!,viewForAnnotation annotation: MKAnnotation!) -> MKAnnotationView!中:

代码语言:javascript
复制
    var annotView:MyAnnotationView? = mapView.dequeueReusableAnnotationViewWithIdentifier("AnnotViewIdentifier") as? MyAnnotationView

                if let trueAnnotView  = annotView
                {
                    // Assegno l'annotazione
                    trueAnnotView.annotation = annotation;
                }
                else
                {
                    // Creo una vista se non disponibile
                    annotView = MyAnnotationView(annotation: annotation, reuseIdentifier: "AnnotViewIdentifier")
                    annotView?.canShowCallout = false
                    annotView?.draggable = true
                    annotView?.enabled = true
                }
                return annotView
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29315530

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档