If I have an NSMutableDictionary keys {B,A,D,C}
and values {custom obj1, custom obj2, custom obj3, custom obj4}
,
I would like this to sort into
{A,B,C,D} -> {custom obj2, custom obj1, custom obj4, custom obj3}
If I have an NSMutableDictionary keys {B,A,D,C}
and values {custom obj1, custom obj2, custom obj3, custom obj4}
,
I would like this to sort into
{A,B,C,D} -> {custom obj2, custom obj1, custom obj4, custom obj3}
You can't sort dictionaries themselves. However you can get the key array [dictionary allKeys]
and sort that. Something like:
NSMutableArray mutableKeys = [[dictionary allKeys] mutableCopy];
[mutableKeys desiredSortingMethod];