How to let the sortedArrayUsingSelector using integer to sort instead of String?

Posted by Tattat on Stack Overflow See other posts from Stack Overflow or by Tattat
Published on 2010-05-02T09:30:11Z Indexed on 2010/05/02 9:37 UTC
Read the original article Hit count: 448

Filed under:
|
|
|

I have some data like this :

1, 111, 2, 333, 45, 67, 322, 4445

NSArray *array = [[myData allKeys]sortedArrayUsingSelector: @selector(compare:)];

If I run this code, it sorted like this:

1, 111, 2,322, 333, 4445, 45, 67,

but I actually want this:

1, 2, 45, 67, 111, 322, 333, 4445

How can I implement it? thz u.

© Stack Overflow or respective owner

Related posts about sorting

Related posts about objective-c