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

Show number produced by sum of custom data on clusters instead of number of pins in cluster #29

Open
yorgosg opened this issue Oct 27, 2015 · 1 comment

Comments

@yorgosg
Copy link

yorgosg commented Oct 27, 2015

Hello, I opened this issue about a feature I would love to have! An app that shows venues that host concerts on map could show a cluster of 4 venue pins but instead of showing the number 4 on it, it could show the sum of concerts of the 4 venues. With the current functionality, I assume I can just remove the annotations that have no concerts. It would be great if we could give a number as metadata on each annotation (number of concerts) and then be able to select to show the sum of this metadata on the clusters. Let me know if this is possible with the current code somehow.
Thanks for all the work!

@ashare80
Copy link
Owner

@yorgosg Hey this is currently possible. You have control over the annotation views for single and cluster annotations. But with the current implementation it could become slow to calculate if the data set becomes large enough.

Every time the map clusters you'll get a delegate call to update the MKAnnotationViews. Cluster annotations will be of class ADClusterAnnotation which will contain an array originalAnnotations where you'll be able to iterate through your annotations and calculate that value.

Likewise you can do a similar calculation by subclassing TSRefreshedAnnotationView instead of MKAnnotationView and placing view changes in the method - (void)clusteringAnimation. This will insert your code within the animation block that repositions views on the map. You would get the cluster annotation by using (ADClusterAnnotation *)self.annotation

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