choefele/CCHMapClusterController

changing the annotation view when isUnique changes

halmueller opened this issue · 2 comments

I'd like to use a different view for the cluster annotation, depending on whether the cluster is a unique item or not. I'm tinkering with the iOS sample app. Instead of the Square.png, I'd like to use MKMarkerAnnotationView if there's just one item, and ClusterAnnotationView if there's more than one.

I have it mostly working for the first drawing pass. But there are times when a cluster's object count changes between 1 and greater than 1. In those cases I end up with the wrong marker type being drawn.

Where would I intercept that change? What would I do to tell the MKMapView to redraw using a different MKAnnotationView subclass? Or would I be better off using a single class that customizes itself at draw time, the same way ClusterAnnotationView does?

Hi @halmueller – you'll need to use the same view for both states (unique/not unique) like in the example because you can update the state of a view but not switch between views when the information changes

Hope that helps

Yes, thanks, that's just what I was looking for.