SHARE
TWEET

Untitled

a guest Jun 25th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top