MKMapView Dial Area

I am trying to use MKMapView. I managed to create a map of the world. However, I cannot change the region:

I have a button that will do this:

NSLog(@"%f, %f, %f, %f,
mapView.region.center.latitude,
mapView.region.center.longitude,
mapView.region.span.latitudeDelta,
mapView.region.span.longitudeDelta);

Now, in my method viewDidLoad, I'm trying to set the start area for viewing:

CLLocationCoordinate2D startCoord;
startCoord.latitude = 49.0;
startCoord.longitude = -123.0;
[mapView setRegion:MKCoordinateRegionMakeWithDistance(startCoord, 200, 200) animated:YES];

When the view is loaded, it displays the same world map, not a smaller area, as expected. Immediately registering the attributes of the region, I get:

0.000000, 0.001417, 0.000000, 0.000000

Moving the map around the bits, resizing and scaling does not change these values โ€‹โ€‹(except that the second returns to 0.000000).

It would seem that mapView.region does not correspond to what I see on the screen, but Iโ€™m quite sure that I made IB links correctly, Iโ€™m looking at them right now. What could be the problem?

+5
1

CLLocationCoordinate2D startCoord = CLLocationCoordinate2DMake(49, -123);
MKCoordinateRegion adjustedRegion = [mapView regionThatFits:MKCoordinateRegionMakeWithDistance(startCoord, 200, 200)];
[mapView setRegion:adjustedRegion animated:YES];
+24

All Articles