0
Ich erstelle eine App in Xcode. Ich habe eine andere Pins auf der MapView, aber ich ant an einen der Pins zu ändern, um den aktuellen Standort (das "Radar" -Symbol) mit einer anderen Farbe anzuzeigen. Wie kann ich das machen? HierWie wird das aktuelle Standortsymbol in Swift 3 angezeigt?
ist der Code Ich habe zur Zeit:
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
if annotation is MKUserLocation {
let pin = mapView.view(for: annotation) as? MKPinAnnotationView ?? MKPinAnnotationView(annotation: annotation, reuseIdentifier: nil)
pin.pinTintColor = #colorLiteral(red: 0.8823529412, green: 0.1647058824, blue: 0.1333333333, alpha: 1)
return pin
} else {
let annotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "pin")
annotationView.pinTintColor = #colorLiteral(red: 0.007843137255, green: 0.3803921569, blue: 0.8156862745, alpha: 1)
return annotationView
}
}
Was ist falsch? Erhalten Sie einen Fehler? Bitte erläutern Sie das tatsächliche Verhalten, das Sie sehen, nicht nur das erwartete Verhalten. –