Open tomrapadmi opened 5 years ago
For anyone struggling with this at this point.
I saw this issue as well. Judging from the behavior I observed with showAnnotations()
, it will add the annotations to the mapview if they aren't already there, bypassing the Clustermanager completely. From the mapView's point of view this happens because it only knows about the CluserAnnotation and has no knowledge of its members.
My workaround was to calculate and generate the region of the annotations manually and then use MKMapView.setRegion(:MKCoordinateRegion)
with that region. It will adjust the region without touching any annotations of the mapview.
Description Calling
MKMapView.showAnnotations(:MKAnnotation)
will zoom the map appropriately to show the annotations passed in, however the cluster manager will never cluster those annotations again (even after calling reload). I tried using the function in 2 ways:mapView.showAnnotations(clusterAnnotation.annotations, animated: true)
mapView.showAnnotations(newAnnotations, animated: true)
In the first case the annotations from the cluster are never clustered again. In the second case no annotations are ever clustered.
Smartphone
Checklist