NSMutableArray *heightArray=[[NSMutableArray alloc]init];
for(int i=0; i<10; i++)
{
float value=(rand()%100.0)/10;
[heightArray addObject:[NSNumber numberWithFloat:value]];
}
NSArray *sortedArray = [heightArray sortedArrayUsingSelector:@selector(compare:)];
//Lets print the sorted Array
NSLog(@"sortedArray=%@",sortedArray);For sorting an array which contains instance of custom class. You can check this old post.
No comments:
Post a Comment