daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (void)viewDidLoad {
  2. [super viewDidLoad];
  3.  
  4.  
  5.  
  6. [self.mapView setRegion:MKCoordinateRegionMake(self.location.coordinate, MKCoordinateSpanMake(0.02, 0.02))];
  7. [self configureOverlay];
  8.  
  9. [[self locationManager] startUpdatingLocation];
  10.  
  11. }
  12.    
  13. CircleOverlay *overlay = [[CircleOverlay alloc] initWithCoordinate:self.location.coordinate radius:self.radius];
  14.  
  15.     [self.mapView addOverlay:overlay];
  16.  
  17.     GeoQueryAnnotation *annotation = [[GeoQueryAnnotation alloc] initWithCoordinate:self.location.coordinate radius:self.radius];
  18.  
  19.     [self.mapView addAnnotation:annotation];
  20.    
  21. CLLocation *location = _locationManager.location;
  22.  
  23.     CLLocationCoordinate2D coordinate = [location coordinate];
  24.    
  25. @interface YourClass () <CLLocationManagerDelegate>
  26.    
  27. #pragma mark CLLocationManagerDelegate Methods
  28.     - (void)locationManager:(CLLocationManager *)manager
  29.         didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
  30. //You can change the overlay coordinates here. Even with an animation if you want.
  31.  
  32.     }
  33.  
  34. - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {
  35.     NSString *errorType = (error.code == kCLErrorDenied) ? @"Access Denied" : @"Unknown Error";
  36.     UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error getting Location"message:errorType delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil];
  37.     [alert show];
  38. }
  39.    
  40. self.locationmanager.delegate = self;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top