NSMutableArray *array1=[NSMutableArray arrayWithObjects:@"1",@"3",@"2", nil];
//NSLog(@"%@",array1);
/*结果:
(
1,
3,
2 )
*/
NSLog(@"%@",array1);
NSArray *array2= [array1 sortedArrayUsingSelector:@selector(compare:)];//注意 这个方法没有修改array1
NSLog(@"%@",array1);
/*结果:
(
1,
3,
2 )
*/
//NSLog(@"%@",array2);
/*结果:
(
1,
2,
3 )
*/
//NSLog(@"%@",array1);
//[array1 sortUsingSelector:@selector(compare:)];//这个方法会修改array1
//NSLog(@"%@",array1);
/*结果:
(
1,
2,
3 )
*/