내 주석 이미지를 맞춤형 이미지로 변경하는 데있어 다른 스택 게시물과 자습서를 따라 왔지만 제대로 작동하지 않는 것 같습니다. 오류 또는 런타임 오류가 나타나지 않으며 주석 이미지가 변경되지 않습니다.Swift - 주석 이미지 변경 중
방금 내가 줄 annotationView!.image = UIImage(named: "RaceCarMan2png.png")
에 중단 점을 설정하고 그 줄이 호출되고 있음을 보여 주지만 아직 아무 일도 일어나지 않습니다. 나는 정말로 당신의 도움에 감사 할 것입니다. 감사.
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
if annotation is MKUserLocation {
return nil
}
let identifier = "MyCustomAnnotation"
var annotationView = mapView.dequeueReusableAnnotationViewWithIdentifier(identifier)
if annotationView == nil {
annotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: identifier)
annotationView?.canShowCallout = true
annotationView!.image = UIImage(named: "RaceCarMan2png.png")
} else {
annotationView!.annotation = annotation
}
configureDetailView(annotationView!)
return annotationView
}
func configureDetailView(annotationView: MKAnnotationView) {
annotationView.detailCalloutAccessoryView = UIImageView(image: UIImage(named: "url.jpg"))
}
정말 고마워요! –