ORMapView
is a drop-in subclass of MKMapView
that displays clusters of annotations. This is very useful in cases where you have to display many annotations on the map.
ORMapView
is actually a fork of ADClusterMapView
I liked their cluster implementation, but didn't need the complex animation code.
I also wanted ORMapView
to be a true drop-in replacement for MKMapView
that does not wrap annotations in it's own MKAnnotation
implementation, forcing you to modify your existing MKMapViewDelegate
code.
The cluster algorithm and code itself (the hard part) is a plain copy from ADClusterMapView
.
The algorithm concept is described on Applidium's website.
Differences to ADClusterMapView
are:
- Does not warp your annotations in a custom
MKAnnotation
implementation which would force you to rewrite yourMKMapViewDelegate
delegate methods which have anMKAnnotation
as a parameter. - Allows you to enable and disable clustering anytime by just setting the
clusteringEnabled
property. - Does not support animations.
- Provides a default cluster annotation view.
ADClusterMapView
classes convert to ARC.
- Add the content of the
ORMapView
folder to your iOS project. - Link against the MapKit and CoreLocation frameworks if you don't already.
- Turn your
MKMapView
instance into anORMapView
instance. - Look at the example project on how to use a custom
MKAnnotationView
subclass for displaying aORClusterAnnotation
on the map.