NSArray* array1=@[@"3",@"59",@"42"];
NSMutableArray* array=[NSMutableArray arrayWithArray:array1];
for (int i=0; i<array.count; i++) {
for (int j= 0; j<array.count-1; j++) {
if ([array[j+1] intValue]< [array[j] intValue]) {
int temp=[array[j] intValue];
array[j]=array[j+1];
array[j+1]=[NSNumber numberWithInteger:temp];
}
}
}
NSLog(@"排序后的数组%@",array);