我在应用程序中使用MapKit,并用


[mapview setShowUserLocation:YES];

我想使用userLocation的坐标设置region.center.latitude和region.center.longitude,该怎么做?

最佳答案

这是我的答案,我尝试类似的方法及其工作方式:


//inside my ViewDidLOad
locManager = [[CLLocationManager alloc] init];
[locManager setDelegate:self];
[locManager setDesiredAccuracy:kCLLocationAccuracyBest];
[locManager startUpdatingLocation];

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation  {
CLLocationCoordinate2D loc = [newLocation coordinate]; [maptView setCenterCoordiante:loc]; }

10-08 06:00