I have a map in my iOS application that won't set the visible region to where I'm specifying it.
- (void)mapView:(MKMapView *)aMapView didUpdateUserLocation:(MKUserLocation*)aUserLocation
{
MKCoordinateSpan span;
span.latitudeDelta = .011932;
span.longitudeDelta = 0.011242;
MKCoordinateRegion region;
region.center = self.mapView.userLocation.coordinate;
region.span = span;
[aMapView setRegion:region animated:YES];
}
That's my code and you would assume it would work, it's pretty straightforward and all. However, it sets the visible region to a slightly but noticeable region above what I want. I printed out the span delta values in mapView:regionDidChangeAnimated
and the values I got back are:
Span: 0.014576, 0.013733
Which is not what I set it to.
Any thoughts as to why? More than anything, I really want to understand why this is happening and if it's a product of using Apple Maps or it's some wonky thing that I'm doing wrong. Upvote if you wouldn't mind so other people who have this issue can get a fix.
This has been a problem with MKMapView forever. Setting the region doesn't set the exact region you pass into it.