Last active
December 29, 2015 08:09
-
-
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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]; | |
// ------------------------------------------------------------ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
//achieves the same effect you are going after.. MKMapRectWorld <- available since iOS 4.0
[self.mapView setVisibleMapRect:MKMapRectWorld animated:YES];