So I am using a clustering library to group annotations and there is a small bug with it whereby some very close together annotations can appear grouped when the map is fully zoomed in. With this being a framework I can't do much about it directly but I can disable all grouping if the map is fully zoomed in. The problem is I can't work out a reliable way of doing this.
Here is my regionDidChangeAnimated
code which is ideally where I would like to check if the map is fully zoomed in (to the point where you cant zoom in any more).
func mapView(mapView: MKMapView, regionDidChangeAnimated animated: Bool) {
NSOperationQueue().addOperationWithBlock {
let scale: Double = Double(self.map.bounds.size.width) / self.map.visibleMapRect.size.width
let annotations = self.clusteringManager?.clusteredAnnotationsWithinMapRect(self.map.visibleMapRect, withZoomScale: scale)
self.clusteringManager?.displayAnnotations(annotations, onMapView: self.map)
}
}
I have tried inspecting the mapView.region.span
property but I'm sure this will change depending on screen size etc...
Any suggestions? Thanks in advance.