尝试添加一个显示当前位置和地图上的图钉的注释,但是当前位置和我要添加的图钉都会添加为图钉。如果我更改了行" view = MKPinAnnotationView(annotation:annotation,reuseIdentifier:" annotation")" to" view = MKAnnotationView(注释:注释,reuseIdentifier:"注释")"两个引脚都没有添加! 救命!
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
//Try to dequeue an annotation like in the table view
var view = mapView.dequeueReusableAnnotationViewWithIdentifier("annotation")
//If you can't dequeue an annotation create one, use the same identifier as above that way these annotations you create down here can be reused eventually.
if view == nil {
view = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "annotation")
view?.canShowCallout = true
}else{
return view
}
return view
}
提前多多感谢。