How do I get an MKMapView to zoom in on a few annotations?

142 views Asked by At

Given two or more CLLocation objects is there a method to return a MKCoordinateRegion zoomed in on the CLLocation objects (or maybe MKAnnotation objects)?

I'm thinking about writing a method that will iterate through annotations property of an MKMapView, find the max/min lat/lon of all annotations and set the center and span based on that (with some padding), but I don't want to go through the effort if it's already somewhere in the framework.

annotationsInMapRect does the inverse of what I want. Instead of a set of annotations located in the specified map rectangle, I want a method that will return a map rect that fits (with padding) a set of annotations.

0

There are 0 answers