Josh Kahane Josh Kahane - 1 year ago 84
Objective-C Question

Sort Numbers in NSArray?

This is driving me up the wall and I can't piece together how to do this.

I fetch my array from a plist, this array is full of numbers (as set in the plist). Now al I need to do is sort them so they are descending, but I can't work it out.

Hope someone can help out, thanks.

Answer Source

Try this code?

 NSArray *array = /* loaded from file */;
 array = [array sortedArrayUsingSelector: @selector(compare:)];