Inherits from NSObject
Declared in CCHMapClusterController.h
CCHMapClusterController.m

Overview

Controller to cluster annotations. Automatically updates clustering when user zooms or pans the map.

Properties

animator

Delegate to define strategy for animating cluster annotations in and out (default: CCHFadeInOutMapAnimator).

@property (nonatomic, weak) id<CCHMapAnimator> animator

Declared In

CCHMapClusterController.h

annotations

Clustered annotations.

@property (nonatomic, copy, readonly) NSSet *annotations

Declared In

CCHMapClusterController.h

cellSize

Cell size in [points] (default: 60).

@property (nonatomic, assign) double cellSize

Declared In

CCHMapClusterController.h

clusterer

Delegate to define strategy for positioning cluster annotations (default: CCHCenterOfMassMapClusterer).

@property (nonatomic, weak) id<CCHMapClusterer> clusterer

Declared In

CCHMapClusterController.h

debuggingEnabled

Displays the grid used for clustering.

@property (nonatomic, assign, getter=isDebuggingEnabled) BOOL debuggingEnabled

Declared In

CCHMapClusterController.h

delegate

Delegate to configure cluster annotations.

@property (nonatomic, weak) id<CCHMapClusterControllerDelegate> delegate

Declared In

CCHMapClusterController.h

mapView

Map view to display clustered annotations.

@property (nonatomic, strong, readonly) MKMapView *mapView

Declared In

CCHMapClusterController.h

marginFactor

Multiplier to extend visible area that’s included for clustering (default: 0.5).

@property (nonatomic, assign) double marginFactor

Declared In

CCHMapClusterController.h

reuseExistingClusterAnnotations

Reuse existing cluster annotations for a cell (default: YES).

@property (nonatomic, assign) BOOL reuseExistingClusterAnnotations

Declared In

CCHMapClusterController.h

Instance Methods

addAnnotations:withCompletionHandler:

Adds annotations and immediately updates clustering.

- (void)addAnnotations:(NSArray *)annotations withCompletionHandler:(void ( ^ ) ( ))completionHandler

Parameters

annotations

Annotations to add.

completionHandler

Called when the clustering finished updating.

Declared In

CCHMapClusterController.h

initWithMapView:

Initializes the cluster controller.

- (id)initWithMapView:(MKMapView *)mapView

Parameters

mapView

MKMapView to use to display clusters.

Declared In

CCHMapClusterController.h

removeAnnotations:withCompletionHandler:

Removes annotations and immediately updates clustering.

- (void)removeAnnotations:(NSArray *)annotations withCompletionHandler:(void ( ^ ) ( ))completionHandler

Parameters

annotations

Annotations to add.

completionHandler

Called when the clustering finished updating.

Declared In

CCHMapClusterController.h

selectAnnotation:andZoomToRegionWithLatitudinalMeters:longitudinalMeters:

Zooms to the position of the cluster that contains the given annotation and selects the cluster’s annotation view.

- (void)selectAnnotation:(id<MKAnnotation>)annotation andZoomToRegionWithLatitudinalMeters:(CLLocationDistance)latitudinalMeters longitudinalMeters:(CLLocationDistance)longitudinalMeters

Parameters

annotation

The annotation to look for. Uses isEqual: to check for a matching annotation previously added with addAnnotations:withCompletionHandler:.

latitudinalMeters

North-to-south distance used for zooming.

longitudinalMeters

East-to-west distance used for zooming.

Declared In

CCHMapClusterController.h