Когда я не устанавливаю делегата на MKMapView
, но добавляю аннотации, их изображения выглядят следующим образом:
Однако, если я верну MKAnnotationView
, вот так:
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
if annotation.isKind(of: MKUserLocation.self) {
return nil
}
guard annotation is MKPointAnnotation else { return nil }
let identifier = "Annotation"
var annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: identifier)
if annotationView == nil {
annotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: identifier)
annotationView!.collisionMode = .circle
annotationView!.canShowCallout = true
} else {
annotationView!.annotation = annotation
}
return annotationView
}
Затем значки выглядят как вертикальная булавка:
Я знаю, что могу использовать пользовательское изображение на MKAnnotationView
. Тем не менее, я хочу по умолчанию, за исключением того, что я хочу, чтобы он выглядел как первый, а не как второй, но я также хочу настроить выноску. Как мне этого добиться?