Skip to content

Instantly share code, notes, and snippets.

@ebinnion
Created January 17, 2012 08:51
Show Gist options
  • Save ebinnion/1625717 to your computer and use it in GitHub Desktop.
Save ebinnion/1625717 to your computer and use it in GitHub Desktop.
Set map region in iOS Mapkit
CLLocationCoordinate2D location;
location.latitude=yourlatitude;
location.longitude=yourlongitude;
span.latitudeDelta=0.01; //or whatever zoom level
span.longitudeDelta=0.01;
region.span=span;
region.center=location;
[mapview setRegion:region animated:TRUE];
[mapview regionThatFits:region];
MKCoordinateRegion CSC;
// Defines the center point of the map
CSC.center.latitude = 33.874809;
CSC.center.longitude = -98.521129;
// Defines the viewable area of the map. Lower numbers zoom in!
CSC.span.latitudeDelta = .003;
CSC.span.longitudeDelta = .003;
[map setRegion:CSC animated:YES];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment