这是我的NSArray
myArray = [NSArray arrayWithObjects: @"a", @"b", @"c", @"d", @"e", nil];
现在我像这样循环遍历数组:
int size = [myArray count];
NSLog(@"there are %d objects in the myArray", size);
for(int i = 1; i <= size; i++) {
NSString * buttonTitle = [myArray objectAtIndex:i];
// This gives me the order a, b, c, d, e
// but I'm looking to sort the array to get this order
// e,d,c,b,a
// Other operation use the i int value so i-- doesn't fit my needs
}
在 for 循环中,这给了我命令:
a, b, c, d, e
但我正在寻找对数组进行排序以获得此顺序:
e, d, c, b, a
有什么想法吗?
我还需要将数组保持在原始排序顺序。