how to use the gps in google map in objective-c
i want to use the gps i开发者_StackOverflown google map to automatically locate the user current location. is mapkit framwork , the gps for iphone in objective-c.
in viewDidLoad write
self.locationManager = [[[CLLocationManager alloc] init] autorelease];
self.locationManager.delegate = self; // Tells the location manager to send updates to this object
self.mapView.delegate = self;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[self.locationManager startUpdatingLocation];
and then implement
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
delegate method newLocation will be user's Location
locationManager is CLLocationManager * locationManager;
精彩评论