作者:Dark-胡俊賢 | 来源:互联网 | 2023-01-04 11:51
1> Kosuke Ogawa..:
使用markerTintColor
.
https://developer.apple.com/documentation/mapkit/mkmarkerannotationview/2873822-markertintcolor
例如
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
let identifier = "marker"
var view: MKMarkerAnnotationView
if let dequeuedView = mapView.dequeueReusableAnnotationView(withIdentifier: identifier)
as? MKMarkerAnnotationView {
dequeuedView.annotation = annotation
view = dequeuedView
} else {
view = MKMarkerAnnotationView(annotation: annotation, reuseIdentifier: identifier)
view.markerTintColor = .blue
}
return view
}