Skip to content

Instantly share code, notes, and snippets.

@sag333ar
Last active December 29, 2015 08:09
Show Gist options
  • Save sag333ar/7641168 to your computer and use it in GitHub Desktop.
Save sag333ar/7641168 to your computer and use it in GitHub Desktop.
Sometimes, in maps, you might need to display entire-world-view. Example, in case of no location found, zoom out to the world view. Following code-snip would help you to achieve the same.
// this code will help you to zoom out to world-view
// step.1 create co-ordianate-span as follows
MKCoordinateSpan span = {.latitudeDelta = 180, .longitudeDelta = 360};
// step.2 crate region as follows
MKCoordinateRegion region = MKCoordinateRegionMake(CLLocationCoordinate2DMake(0.0000f, 0.0000f), span);
// step.3 zoom using region to map as follows
[self.mapView setRegion:region animated:YES];
// ------------------------------------------------------------
@chuthan20
Copy link

//achieves the same effect you are going after.. MKMapRectWorld <- available since iOS 4.0
[self.mapView setVisibleMapRect:MKMapRectWorld animated:YES];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment