Set ZoomRegion for Map

suggest change

To center on the user and show 2000 meters north–south and 2000 meters east–west, use the following code. MKCoordinateRegionMakeWithDistance takes those full spans, not a radius. userLocation.location is nil until a location is known, and reading coordinate then crashes.

MKUserLocation *userLocation = _mapView.userLocation;
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance (userLocation.location.coordinate, 2000, 2000);
[_mapView setRegion:region animated:NO];

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents