迄今为止,我有以下几点,但若发言,我可以 figure忙地获得指示函。 任何想法? 理想的情况是,我要扩大拥有某种类别的CLocation类别。
-(NSString *)nicePosition{
double latitude = [self.latitude doubleValue];
double longitude = [self.longitude doubleValue];
int latSeconds = (int)round(latitude * 3600);
int latDegrees = latSeconds / 3600;
latSeconds = abs(latSeconds % 3600);
int latMinutes = latSeconds / 60;
latSeconds %= 60;
int longSeconds = (int)round(longitude * 3600);
int longDegrees = longSeconds / 3600;
longSeconds = abs(longSeconds % 3600);
int longMinutes = longSeconds / 60;
longSeconds %= 60;
//TODO: Use N,E,S,W notation in lat/long
return [NSString stringWithFormat:@"%i° %i %i", %i° %i %i"", latDegrees, latMinutes, latSeconds, longDegrees, longMinutes, longSeconds];
}
关于记录,我做了以下工作。
-(NSString *)nicePosition{
double latitude = [self.latitude doubleValue];
double longitude = [self.longitude doubleValue];
int latSeconds = (int)round(abs(latitude * 3600));
int latDegrees = latSeconds / 3600;
latSeconds = latSeconds % 3600;
int latMinutes = latSeconds / 60;
latSeconds %= 60;
int longSeconds = (int)round(abs(longitude * 3600));
int longDegrees = longSeconds / 3600;
longSeconds = longSeconds % 3600;
int longMinutes = longSeconds / 60;
longSeconds %= 60;
char latDirection = (latitude >= 0) ? N : S ;
char longDirection = (longitude >= 0) ? E : W ;
return [NSString stringWithFormat:@"%i° %i %i" %c, %i° %i %i" %c", latDegrees, latMinutes, latSeconds, latDirection, longDegrees, longMinutes, longSeconds, longDirection];
}