Annotation Title in MapKit is not visible anymore

254 views Asked by At

I uploaded an App to the AppStore on Monday. Everything worked fine. Since Thursday the Title of added Annotation is not visible anymore.

The App has an array of some Point of Interests. Each has a title and the coordinates. The PoI are showing and i can filter them for the title. But the title is not visible.

Preview current view

Preview on Monday

1

There are 1 answers

1
iSoldier On

I just fix it by adding the following function. Unfortunately it shows the title only by tabbing the pin.

func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
    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!.canShowCallout = true
        
        
    } else {
        annotationView!.annotation = annotation
    }

    return annotationView
}