2

I have an MKMapView in my App and I've added couple of annotations to it. the problem I am facing is that whenever the map is zoomed out the annotations are clustered automatically. How do I disable this automatic clustering? I am adding couple of screenshots to demonstrate.

I have tried the answer here by setting the clusteringIdentifier of MKAnnotation to nil like this

func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
    let annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: "marker")            annotationView?.isHidden = false
    annotationView?.clusteringIdentifier = nil
    return annotationView
}

but it didn't solve the problem

Rezwan
  • 367
  • 4
  • 18
  • You need to define subclass of MKMarkerAnnotationView and set the `clusteringIdentifier` to nil. See also Apple's sample code https://developer.apple.com/sample-code/wwdc/2017/MapKit-Sample.zip – Kosuke Ogawa Feb 13 '18 at 00:51
  • I've described alternative solution here: https://stackoverflow.com/questions/49020023/mapkit-annotations-disappearing – Leszek Szary Jun 08 '18 at 08:01

0 Answers0