Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CLLocationManager *locationManager = [[CLLocationManager alloc] init];
- locationManager.delegate = self;
- locationManager.desiredAccuracy = kCLLocationAccuracyBest;
- locationManager.distanceFilter = kCLDistanceFilterNone;
- /* Pinpoint our location with the following accuracy:
- *
- * kCLLocationAccuracyBestForNavigation highest + sensor data
- * kCLLocationAccuracyBest highest
- * kCLLocationAccuracyNearestTenMeters 10 meters
- * kCLLocationAccuracyHundredMeters 100 meters
- * kCLLocationAccuracyKilometer 1000 meters
- * kCLLocationAccuracyThreeKilometers 3000 meters
- */
- [locationManager startUpdatingLocation];
- - (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
- {
- MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(userLocation.coordinate, 800, 800);
- [self.mapView setRegion:[self.mapView regionThatFits:region] animated:YES];
- // Add an annotation
- MKPointAnnotation *point = [[MKPointAnnotation alloc] init];
- point.coordinate = userLocation.coordinate;
- point.title = @"Where am I?";
- point.subtitle = @"I'm here!!!";
- [self.mapView addAnnotation:point];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement