Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mapView.showAnnotations breaks clustering #112

Open
tomrapadmi opened this issue May 21, 2019 · 1 comment
Open

mapView.showAnnotations breaks clustering #112

tomrapadmi opened this issue May 21, 2019 · 1 comment

Comments

@tomrapadmi
Copy link

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:

  1. When a cluster is clicked: mapView.showAnnotations(clusterAnnotation.annotations, animated: true)
  2. When the annotations are initially created: 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

  • Device: iPhone XR, iPhone 8
  • OS: iOS 12.2
  • Version: 3.0.0

Checklist

@spiegelsauce
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants