Ascending & Descending Order

 NSArray *number =@[@9,@3,@6,@7];
    
    NSLog(@"%@",number);

  
   NSArray  *ascending = [number sortedArrayUsingSelector: @selector(compare:)];
    NSLog(@"%@",ascending);

    NSArray *decending = [[[number sortedArrayUsingSelector:@selector(compare:)] reverseObjectEnumerator] allObjects];

    NSLog(@"%@",decending);
Previous
Next Post »