我需要从这个方法返回经度和纬度。这是来自locationManager
代码。当我记录经纬度时,它们给出了正确的值。
我一直无法做的是让你从这个方法中导出/返回变量。我应该如何去改变它?
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
int degrees = newLocation.coordinate.latitude;
double decimal = fabs(newLocation.coordinate.latitude - degrees);
int minutes = decimal * 60;
double seconds = decimal * 3600 - minutes * 60;
self.lat = [NSString stringWithFormat:@"%d° %d' %1.4f\"", degrees, minutes, seconds];
NSLog(@"Current Latitude : %@",self.lat);
degrees = newLocation.coordinate.longitude;
decimal = fabs(newLocation.coordinate.longitude - degrees);
minutes = decimal * 60;
seconds = decimal * 3600 - minutes * 60;
self.longt = [NSString stringWithFormat:@"%d° %d' %1.4f\"", degrees, minutes, seconds];
NSLog(@"Current Longitude : %@",self.longt);
[manager stopUpdatingLocation];
}