choefele/CCHMapClusterController

How to show a table when tapping on pin.

Closed this issue · 2 comments

Let's assume I have few items (e.g. 10) that are located on the same lat and lng on the map.
Then when I zoom in a map as max as I can I want to tap on this 10 badge and see a table of items.

We can skip implementation of the table of course, but which callback should I implement to make it done?

Please have a look at this code recipe. The MKAnnotationView object you will receive is a CCHMapClusterAnnotation, which has a property annotations with all the annotations in the cluster.

yea, thanks so much!!!

I use this solution. So each my KNCustomPointAnnotation has custom object (NSDictionary), which I want to access:

`<- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
ClusterAnnotationView *clusterAnnotationView = (ClusterAnnotationView *)view;

// Check if there are many annotations in the cluster.
if (clusterAnnotationView.count > 1)
{
    [mapView deselectAnnotation:view.annotation animated:NO];

    CCHMapClusterAnnotation *clusterAnnotation = clusterAnnotationView.annotation;

    [self.myAnnotions removeAllObjects];

    for (KNCustomPointAnnotation *oneAnnotation in [clusterAnnotation.annotations allObjects])
    {
        [self. self.myAnnotions addObject:oneAnnotation.customObject];
    }

    [self doSomething];
}

}>`