Ich versuche, die Annotation der benutzerdefinierten Standardposition für die MKMapView von Blau in ein benutzerdefiniertes Bild mit dem Namen geo zu ändern. Es trifft die Grenze, um es auf geo zu setzen, wenn ich Haltepunkte setze, aber beide Punkte (der Benutzerstandard und der Passagierpunkt sind Standard-Rotpunkt-Anmerkungen) Richte ich das falsch ein, oder gibt es bestimmte Bildvorgaben?Ändern der MKMapView-Benutzerstandort-Annotation
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
if annotation.isKindOfClass(PassengerLocation) == false {
//User location
let userIdentifier = "UserLocation"
var annotationView = mapView.dequeueReusableAnnotationViewWithIdentifier(userIdentifier)
if annotationView == nil {
annotationView = MKPinAnnotationView(annotation:annotation, reuseIdentifier:userIdentifier)
}
annotationView!.annotation = annotation
annotationView!.canShowCallout = true
// THIS IS NOT WORKING, DEFAULT RED PIN POINT STILL SHOWING
annotationView!.image = UIImage(named: "geo")
return annotationView
}
let identifier = "PassengerLocation"
if let annotationView = mapView.dequeueReusableAnnotationViewWithIdentifier(identifier) {
annotationView.annotation = annotation
return annotationView
} else {
let annotationView = MKPinAnnotationView(annotation:annotation, reuseIdentifier:identifier)
annotationView.enabled = true
annotationView.canShowCallout = true
let btn = UIButton(type: .DetailDisclosure)
annotationView.rightCalloutAccessoryView = btn
return annotationView
}
}
Hat es Ihnen helfen? – 123FLO321