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 中知道:SORT BY ...)

Xcode 4.3(更新版本),Mac OS X Lion

4

1 回答 1

2
NSArray *sortedArray =
             [detailTexts sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
于 2012-07-03T18:44:48.763 回答