开发者

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;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜