-1
我有一个parentArray与它的索引的子数组。每个子数组都有一个包含多个键值对的字典。一个键有一个儿童字典作为其值。基于这个子字典的其中一个值,我想排序parentArray。排序NSArray的字典的NSArray
ParentArray [
ChildArray [{
parentKey: {
childKey: <the value to sort parentArray>
}
}],
ChildArray [{
parentKey: {
childKey: <the value to sort parentArray>
}
}]
]
childKey的值是我想对我的ParentArray进行排序的值。
行,所以你尝试过什么? – trojanfoe
我正在做的是将子数组转换为自定义对象,然后对该自定义对象的属性进行父级排序。它肯定会解决问题,但想知道是否有更直接的方法。 – iAmd
'[NSArray sortedArrayUsingComparator:]'会工作。 – trojanfoe