Created
April 29, 2013 03:04
-
-
Save Morse-Code/5479484 to your computer and use it in GitHub Desktop.
Zoom map region to current location.
This file contains 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
- (IBAction)zoomToCurrentLocation:(id)sender | |
{ | |
NSLog(@"zoomToCurrentLocation"); | |
//Start updating location because we want it... | |
[_myLocationManager startUpdatingLocation]; | |
NSLog(@"lat: %f", _myLocationManager.location.coordinate.latitude); | |
NSLog(@"long: %f", _myLocationManager.location.coordinate.longitude); | |
MKCoordinateRegion | |
viewRegion = MKCoordinateRegionMakeWithDistance(_myLocationManager.location.coordinate, defaultRange, | |
defaultRange); | |
[_dangerMap setRegion:viewRegion animated:YES]; | |
//Stop updating location to save battery | |
[_myLocationManager stopUpdatingLocation]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment