func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
guard annotation is MKPointAnnotation else { return nil }
let identifier = "Annotation"
var annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: identifier)
if annotationView == nil {
annotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: identifier)
annotationView!.canShowCallout = true
annotationView!.pinTintColor = UIColor.redColor
} else {
annotationView!.annotation = annotation
}
return annotationView
}
为什么我有错误“'MKAnnotationView' 类型的值没有成员'pinTintColor'”?我想在不改变图像的情况下将别针的颜色从橙色更改为蓝色。我使用 swift 5.2 和 xcode 11.4.1