我有一个嵌套数组,想通过内部数组中存在的键对其进行排序。下面给出的是我想使用NSSortDescriptor
或以其他方式排序的数组。
fares(
{
pid = 1;
type1 = (
{
color = "red";
size = "big";
properties = (
{
mod = "auto";
payment = "EMI";
moresegs = (
{
id = 141;
name = "abcd";
duration = "1 year"
})
})
});
type2 = (
{
color = "green";
size = "small";
properties = (
{
mod = "auto";
payment = "EMI";
moresegs = (
{
id = 141;
name = "abcd";
duration = "1 year"
})
})
})
}
{
pid = 1;
type1 = (
{
color = "red";
size = "big";
properties = (
{
mod = "auto";
payment = "EMI";
moresegs = (
{
id = 141;
name = "abcd";
duration = "1 year"
})
})
});
type2 = (
{
color = "green";
size = "big";
properties = (
{
mod = "auto";
payment = "EMI";
moresegs = (
{
id = 141;
name = "abcd";
duration = "1 year"
})
})
})
})
如何使用键“type2->properties->payment”对数组进行排序?
- - - -更新 - - - - - -
我修改了数组并使用了 NSSortDescriptor 解决了我的问题