如果我有NSMutableDictionary keys {B,A,D,C}
和values {custom obj1, custom obj2, custom obj3, custom obj4}
,
我希望这可以归类为
{A,B,C,D} -> {custom obj2, custom obj1, custom obj4, custom obj3}
答案 0 :(得分:0)
您无法自行排序词典。但是,您可以获取密钥数组[dictionary allKeys]
并对其进行排序。类似的东西:
NSMutableArray mutableKeys = [[dictionary allKeys] mutableCopy];
[mutableKeys desiredSortingMethod];