Set ZoomRegion for Map
suggest changeTo 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];
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents