Hallo Leute, ich versuche, den Stift meiner Anmerkung zu einem benutzerdefinierten Bild zu ersetzen.Bild zu Annotation anstelle von Pin zuweisen
Ich habe bereits die Bilder in meinem Bild.Kassettenliste wird 1X 2X 3X usw. angezeigt, aber sobald ich versuche, dieses Bild aufzurufen, bekomme ich einen Fehler in meinem Code, wo Xcode
versucht, meine Syntax zu reparieren, aber schließlich wirft es out als Fehler
mein Code unter Überschreibung func aufgelistet
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
guard !(annotation is MKUserLocation) else {
return nil
}
let annotationIdentifier = "AnnotationIdentifier"
var annotationView: MKAnnotationView?
if let dequeuedAnnotationView = mapView.dequeueReusableAnnotationView(withIdentifier: annotationIdentifier) {
annotationView = dequeuedAnnotationView
annotationView?.annotation = annotation
}
else {
annotationView = MKAnnotationView(annotation: annotation, reuseIdentifier: annotationIdentifier)
annotationView?.rightCalloutAccessoryView = UIButton(type: .detailDisclosure)
}
if let annotationView = annotationView {
annotationView.canShowCallout = true
annotationView.image = UIImage(named: "House")
}
return annotationView
}
Jetzt Xcode
einen Fehler im Code hier Abholung ist annotationView.image = UIImage (genannt: "House"), wo sie bitten, Einfügen "," und das Endergebnis sieht wie folgt aus
annotationView.image = UIImage(named: "#imageLiteral(resourceName: ",House,")")
Xcode
wird dann eine Fehler Verwendung von ungelösten Kennung anzuzeigen ‚Haus‘
was bedeutet der Fehler sagen fixiert? – GeneCode
Verwendung der unaufgelösten Kennung 'Haus' – sabrefm1