2010-05-12 35 views

回答

2
在viewDidLoad中

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;