我想在谷歌地图中使用gps来自动定位用户当前位置。 是mapkit framwork,在objective-c中为iphone的gps。
答案 0 :(得分:2)
写
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];
然后 实施
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
委托方法newLocation将是用户的位置
locationManager是CLLocationManager * locationManager;