I have an array of MKMapItems and I am trying to find the coordinates I can plug into the bounding region that will make the most zoomed in map that contains all the MKMapItems
Each of these map items has coordinates so with some simple calculations of bounds the 4 corners can be found. I'm looking for a function that has already been defined if it is available.
If there is not already a predefined function, any help is figuring out the appropriate span value for a given set of points would be appreciated as well!
Thanks in advance!
iOS 7 has the method:
- (void)showAnnotations:(NSArray *)annotations animated:(BOOL)animated
Give it an array of placemarks and it will change the region for you:
[self.mapView showAnnotations:placemarks animated:YES];
You can get the placemarks from the map items:
NSMutableArray *placemarks = [NSMutableArray array];
for (MKMapItem *mapItem in mapItems) {
[placemarks addObject:mapItem.placemark];
}