I need so sort an array with an array inside, something like this:
NSMutableArray * array_example = [[NSMutableArray alloc] init];
[array_example addObject:[NSMutableArray arrayWithObjects:
string_1,
string_2,
string_3,
nil]
];
how can i order this array by the field “string_1” of the array???
any idea how can i do that?
Thanks
For iOS 4 and later, this is easily done using a comparator block:
If you’re interested in how blocks work, you can have a look at Apple’s Short Practical Guide to Blocks.
If you wish to support iOS 3.x, you’d have to use a custom comparison function:
and then use: