在当前时刻,NSMutableArray
CLLocations
CLLocation
<-42.86672600,+147.32411407> +/- 0.00m (speed -1.00 mps / course -1.00) @ 12/11/14, 7:51:06 AM Australian Eastern Daylight Time-<-42.86413769,+147.32383317> +/- 0.00m (speed -1.00 mps / course -1.00) @ 12/11/14, 7:52:30 AM Australian Eastern Daylight Time-<-42.86596128,+147.32764541> +/- 0.00m (speed -1.00 mps / course -1.00) @ 12/11/14, 7:52:33 AM Australian Eastern Daylight Time"
,我不需要每个-42.86672600,+147.32411407/-42.86413769,+147.32383317/-42.86596128,+147.32764541
。当前时刻的日志是:
{{1}}
如何将阵列缩小,只显示纬度和经度,即阵列如下: {{1}} ...
干杯, SebOH
答案 0 :(得分:2)
如果您确定他们只是CLLocation
个对象,那么......
for (CLLocation *location in array) {
NSLog(@"%f, %f", location.coordinate.latitude, location.coordinate.longitude);
}
这将在一行中注销每个lat和long。
如果你想要那个特定的字符串......
NSMutableString *string = [NSMutableString string];
for (CLLocation *location in array) {
[string appendFormat:@"%f,%f/", location.coordinate.latitude, location.coordinate.longitude];
}
NSLog(@"%@", string);
这将记录您在问题中输入的确切字符串。