2012-07-03 36 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