I have an array populated by dictionaries, and I need to sort the array alphabetically by the values of one of the keys of the dictionaries.
This is my array:
tu dictus: (
{
brand = Ryul;
productTitle = Any;
quantity = 1;
subBrand = "Ryul INJ";
type = Product;
},
{
brand = Trol;
productTitle = Different;
quantity = 2;
subBrand = "";
type = Brand;
},
{
brand = Dtor;
productTitle = Any;
quantity = 1;
subBrand = "";
type = Product;
},
{
brand = Ryul;
productTitle = Different;
quantity = 2;
subBrand = "Ryul CHES";
type = SubBrand;
},
{
brand = Anan;
productTitle = Any;
quantity = 1;
subBrand = "";
type = Product;
}
)
Normally for sorting an array I will use
myArray = [uniqueProdsArray sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
But how do sort using the brand
key of the dictionary?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…