我在iOS 8.x上使用Swift。我在我的地图(工具包)上有一些自定义图像的注释。现在,我希望用户能够使用拖放与引脚。这已经起作用了,但每次用户单击(并按住)注释时,将显示标注而不是拖动动画。在标注可见并再次单击注释后,我可以将其拖放到周围。
如果用户按下并按住注释,我如何才能更改行为,使其不显示标注,而是开始拖放?
谢谢
发布于 2015-03-28 17:39:29
在您的注释(mapView: MKMapView!,viewForAnnotation annotation: 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 annotViewhttps://stackoverflow.com/questions/29315530
复制相似问题