DeviOS
DeviOS

Reputation: 1

Pin annotation is not showing in MKMapView when both longitude and latitude are 0

In MKMapView I can display my annotation with no problem using this code except when longitude and latitude are both zero

    func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
        var view: MKPinAnnotationView
        guard let annotation = annotation as? CustomAnnotation else { return nil }

        if let dequeuedView = mapView.dequeueReusableAnnotationView(withIdentifier: annotation.identifier)
            as? MKPinAnnotationView {
            view = dequeuedView
        } else { // make a new view
            view = MKPinAnnotationView(annotation: annotation, reuseIdentifier: annotation.identifier)
        }
    }

Still if the coordinate is shown once (long/lat # 0), then I have no issue with the pin.

Any suggestions please

Upvotes: 0

Views: 18

Answers (0)

Related Questions