Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self.mapView setRegion:MKCoordinateRegionMake(self.location.coordinate, MKCoordinateSpanMake(0.02, 0.02))];
- [self configureOverlay];
- [[self locationManager] startUpdatingLocation];
- }
- CircleOverlay *overlay = [[CircleOverlay alloc] initWithCoordinate:self.location.coordinate radius:self.radius];
- [self.mapView addOverlay:overlay];
- GeoQueryAnnotation *annotation = [[GeoQueryAnnotation alloc] initWithCoordinate:self.location.coordinate radius:self.radius];
- [self.mapView addAnnotation:annotation];
- CLLocation *location = _locationManager.location;
- CLLocationCoordinate2D coordinate = [location coordinate];
- @interface YourClass () <CLLocationManagerDelegate>
- #pragma mark CLLocationManagerDelegate Methods
- - (void)locationManager:(CLLocationManager *)manager
- didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
- //You can change the overlay coordinates here. Even with an animation if you want.
- }
- - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {
- NSString *errorType = (error.code == kCLErrorDenied) ? @"Access Denied" : @"Unknown Error";
- UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error getting Location"message:errorType delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil];
- [alert show];
- }
- self.locationmanager.delegate = self;
Add Comment
Please, Sign In to add comment