- (NSArray *)invertedOrder
{
//1.先拷贝副本
NSMutableArray *arr = [NSMutableArray arrayWithArray:self];
for (int i = 0; i < [arr count] / 2; i++) {
[arr exchangeObjectAtIndex:i withObjectAtIndex:[arr count] - i - 1];
}
return arr;
}
</span>
<span style="font-family:KaiTi_GB2312;font-size:24px;">NSArray *arr = @[@"aa",@"bb",@"cc",@"dd",@"ee"]; // 0 - 1
NSArray *arr1 = [arr invertedOrder];
NSLog(@"%@",arr1);</span>