Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. CLLocationManager *locationManager = [[CLLocationManager alloc] init];
  2. locationManager.delegate = self;
  3. locationManager.desiredAccuracy = kCLLocationAccuracyBest;
  4. locationManager.distanceFilter = kCLDistanceFilterNone;
  5. /* Pinpoint our location with the following accuracy:
  6. *
  7. * kCLLocationAccuracyBestForNavigation highest + sensor data
  8. * kCLLocationAccuracyBest highest
  9. * kCLLocationAccuracyNearestTenMeters 10 meters
  10. * kCLLocationAccuracyHundredMeters 100 meters
  11. * kCLLocationAccuracyKilometer 1000 meters
  12. * kCLLocationAccuracyThreeKilometers 3000 meters
  13. */
  14. [locationManager startUpdatingLocation];
  15.  
  16. - (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
  17. {
  18.     MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(userLocation.coordinate, 800, 800);
  19.     [self.mapView setRegion:[self.mapView regionThatFits:region] animated:YES];
  20.  
  21.     // Add an annotation
  22.     MKPointAnnotation *point = [[MKPointAnnotation alloc] init];
  23.     point.coordinate = userLocation.coordinate;
  24.     point.title = @"Where am I?";
  25.     point.subtitle = @"I'm here!!!";
  26.    
  27.     [self.mapView addAnnotation:point];
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement