0
我有一个应用程序,允许用户在一个视图上选择大学,并在他们选择后,该视图解散并显示地图。目前,我使用下面的代码,但它动画所有注释。我希望现有的注释不会动画,只有当视图被解散时才会对新选择的大学生成动画。如何动画刚删除的注释?
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
let reuseID = "pin"
var pinView = mapView.dequeueReusableAnnotationViewWithIdentifier(reuseID) as? MKPinAnnotationView
if pinView == nil {
pinView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: reuseID)
pinView?.canShowCallout = true
pinView?.rightCalloutAccessoryView = UIButton(type: .DetailDisclosure)
pinView?.animatesDrop = true
} else {
pinView?.annotation = annotation
pinView?.animatesDrop = true
}
return pinView
}