Skip to content

Instantly share code, notes, and snippets.

@filipbec
Last active August 29, 2015 14:06
Show Gist options
  • Save filipbec/8219f82bc29dc9d37fd7 to your computer and use it in GitHub Desktop.
Save filipbec/8219f82bc29dc9d37fd7 to your computer and use it in GitHub Desktop.
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated
{
double scale = self.mapView.bounds.size.width / self.mapView.visibleMapRect.size.width;
if (scale < <#yourScaleLimit#>) {
[[NSOperationQueue new] addOperationWithBlock:^{
NSArray *annotations = [self.clusteringManager clusteredAnnotationsWithinMapRect:mapView.visibleMapRect withZoomScale:scale];
[self.clusteringManager setAnnotations:annotations forMapView:self.mapView];
}];
} else {
[[NSOperationQueue new] addOperationWithBlock:^{
[self.clusteringManager setAnnotations:<#self.annotationsArray#> forMapView:self.mapView];
}];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment