views:

68

answers:

1

Hi all,

I have an mkmapview that i'm currently adding pins to, but for some reason when I call [mapView setRegion:[detailItem coordinateRegion] animated:YES]; the pin is off-centered (toward the right side of the screen) on the map. Here is the code for [deailItem coordinateRegion]:

- (MKCoordinateRegion)coordinateRegion {
    MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };
    region.center = self.coordinate;
    region.span.longitudeDelta = 0.0075f;
    region.span.latitudeDelta  = 0.0075f;
    return (region);
}

I'm setting the coordinateRegion's center to the object's x,y coordinate, so why is it off-center on the map? I feel like there's something I'm missing here...

::Val::

A: 

The documentation discusses this the vert vs. horizontal spans are not identical because one degree of latitude does not equal one degree of longitude. This effect will be more pronounced by the poles. Try using setCenter after you've applied the region. See the docs for further discussion of span.

Nick