2012-07-03 120 views
0

我有一个数组,命名为detailTexts具有彩车他的数据:用整数对数组排序?

CLLocation *location = [[CLLocation alloc] initWithLatitude:dlog longitude:dlig]; 
**CLLocationDistance meters = [userLocation distanceFromLocation:location];** 
**float detailFloat = meters * 1000;** 
if (meters < 10000) { 
    NSLog(@"%@", detailText); 
    [tableData addObject:name]; 
    **detailText = [NSString stringWithFormat:@"%f", detailFloat];** 
    **[detailTexts addObject:detailText];** 
} 

我怎么可以在阵列来获得近地点第一排序? (我知道这在MySQL:排序...)

的Xcode 4.3(更新版)的Mac OS X Lion的

+0

http://stackoverflow.com/questions/7769492/sort-by-距离/ 7769557#7769557 – vikingosegundo

回答

2
NSArray *sortedArray = 
      [detailTexts sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; 
+0

谢谢。加工。 – theShay