我在iOS 8.x上使用Swift。我的地图(套件)上有一些带有自定义图像的注释。现在我希望用户能够使用引脚拖放。这已经有效,但每次用户点击(并按住)注释时,都会显示标注而不是拖动动画。在标注可见之后,我再次单击注释,我可以拖放它。
如何更改行为以便我不会显示标注,但如果用户按住并按住注释,则会开始拖放操作?
由于
答案 0 :(得分:-1)
在你的mapView中(mapView:MKMapView!,viewForAnnotation注释:MKAnnotation!) - > MKAnnotationView! :
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