objective-ciosmkmapviewxcode4.3

Why isn't my MKMapView zooming out as much as it should?


I generally have no problem placing annotations on my MKMapView. I have pins for various locations and the code automatically centers and sets the span based on the max and min values. However, I am noticing that when I add more and more points, there is a certain amount my map will zoom out to see, and I lose what is on the edges. Here are some pics:

This is how it looks when I first load the MKMapView:


(source: grapekeeper.com)

When I pan I can see more pins that are lost on that original view:


(source: grapekeeper.com)

And when I pinch in the simulator this is as zoomed out as it goes:


(source: grapekeeper.com)

Here's my code for reference:

double min = [[allLatitudes valueForKeyPath:@"@min.self"] doubleValue];
double max = [[allLatitudes valueForKeyPath:@"@max.self"] doubleValue];
double latSpan = max-min;
double minL = [[allLongitudes valueForKeyPath:@"@min.self"] doubleValue];
double maxL = [[allLongitudes valueForKeyPath:@"@max.self"] doubleValue];
double lonSpan = maxL-minL;
double avgLatitude = (max+min)/2;
double avgLongitude = (maxL+minL)/2;

overallRegion.center.latitude = avgLatitude;
overallRegion.center.longitude = avgLongitude;
overallRegion.span.latitudeDelta = latSpan;
overallRegion.span.longitudeDelta = lonSpan;

[self.mapView setRegion:overallRegion animated:YES];

Solution

  • The answer is: it's not possible to zoom out enough to view the entire world using the map view.