Created
January 12, 2012 10:15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CLLocationCoordinate2D min = CLLocationCoordinate2DMake(99999.0, 99999.0); | |
CLLocationCoordinate2D max = CLLocationCoordinate2DMake(-99999.0, -99999.0); | |
// find max/min.... | |
// zoom to cover area | |
// TODO: Maybe better using a MKPolygon which can calculate its own fitting region. | |
CLLocationCoordinate2D center = CLLocationCoordinate2DMake((max.latitude + min.latitude) / 2.0, (max.longitude + min.longitude) / 2.0); | |
MKCoordinateSpan span = MKCoordinateSpanMake(max.latitude - min.latitude, max.longitude - min.longitude); | |
MKCoordinateRegion region = MKCoordinateRegionMake(center, span); | |
[_mapView setRegion:[_mapView regionThatFits:region] animated:YES]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment