choefele/CCHMapClusterController

Custom annotationview for non-clustered pin

Closed this issue · 2 comments

Hi,
I am using pins to locate status on a map. Clustering works great but i would like to add a custom annotation view for single pin ( isUniqueLocation == YES && count == 1) but i don't how to send data to annotation view

  • (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id)annotation {
    MKAnnotationView *annotationView;

    if ([annotation isKindOfClass:CCHMapClusterAnnotation.class])
    {
    static NSString *identifier = @"clusterAnnotation";
    ClusterAnnotationView *clusterAnnotationView = (ClusterAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:identifier];
    if (clusterAnnotationView) {
    clusterAnnotationView.annotation = annotation;
    } else {
    clusterAnnotationView = [[ClusterAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];

        }
        CCHMapClusterAnnotation *clusterAnnotation = (CCHMapClusterAnnotation *)annotation;
        clusterAnnotationView.count = clusterAnnotation.annotations.count;
        clusterAnnotationView.uniqueLocation = clusterAnnotation.isUniqueLocation;
        clusterAnnotationView.cluster = clusterAnnotation.isCluster;
        clusterAnnotationView.imageURL = clusterAnnotation.imageURL;
    NSLog(@"%@ URL", clusterAnnotation.imageURL);
        annotationView = clusterAnnotationView;
    return annotationView;
    }
    

    return nil;
    }

but imageURL is always NULL here..
Any idea?

Here is an example of an annotation view that changes its image depending on the name of clustered annotations contained in the cluster.

Haven't heard back for this issue in a while – I assume it has been solved.