How do I reset an MKMapView
back to the world view zoom level?
For those hoping to do this in Swift:
let region = MKCoordinateRegion(.world)
mapView.setRegion(region, animated: true)
The map rect for the world is stored as a constant named MKMapRectWorld
.
MKCoordinateRegion worldRegion = MKCoordinateRegionForMapRect(MKMapRectWorld);
map.region = worldRegion;
One other way is to set the zoom level of the map. Although the MapKit framework does not support zoom levels as Google Maps API does, you can use this category extension written by Troy Brant.
Set the center coordinate to 0, 0 with zoom level 0 to get the same result.
[map setCenterCoordinate:CLLocationCoordinate2DMake(0, 0) zoomLevel:0 animated:0];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With