I have an array that contains values like 0,3,2,8 etc.I want to sort my array in increasing order.Please tell me how to do this.
Thanks in advance!!
Use the code: [[myData allKeys]sortedArrayUsingSelector:@selector(psuedoNumericCompare:)]
;
myData is your array. If you use that line in your code, it will sort on size of the integer (and not alphabetic, so it won't sort like 1, 111, 2,322, 333, 4445, 45, 67
but like 1, 2, 45, 67, 111, 322, 333, 4445
).
Original source: How to let the sortedArrayUsingSelector using integer to sort instead of String?