我被困在这里我在这里有纬度和经度数组,从 JSON Parsing 获取
Arr_Lat=[[[[main valueForKey:@"responseData"]valueForKey:@"results"]valueForKey:@"lat"] copy];
Arr_Long=[[[[main valueForKey:@"responseData"]valueForKey:@"results"]valueForKey:@"lng"] copy];
我已经计算了当前位置和经纬度索引数组之间的距离,并存储到一个数组中......
CLLocation *currLoc = [[CLLocation alloc] initWithLatitude:appDel.curr_lat longitude:appDel.curr_long];
CLLocation *destLoc = [[CLLocation alloc] initWithLatitude:appDel.str_lat longitude:appDel.str_long];
distance = [destLoc distanceFromLocation:currLoc]/1000;
DistStr = [[NSMutableString alloc]initWithFormat:@" %0.3f",distance];
[appDel.Arr_distance addObject:DistStr];
我对距离进行了这样的排序
NSSortDescriptor *sortDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"self" ascending:YES]autorelease];
sortedFloats = [appDel.Arr_distance sortedArrayUsingDescriptors:
[NSArray arrayWithObject:sortDescriptor]];
我已经显示了标题、地址和距离,但地址和距离不匹配我想根据升序距离数组对地址进行排序....
提前感谢您的帮助........