Tôi có một mảng được điền theo từ điển và tôi cần sắp xếp mảng theo thứ tự bảng chữ cái theo các giá trị của một trong các khóa của từ điển.Sắp xếp NSArray của từ điển theo giá trị của một khóa trong từ điển
Đây là mảng của tôi:
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;
}
)
Thông thường để phân loại một mảng tôi sẽ sử dụng
myArray = [uniqueProdsArray sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
Nhưng làm thế nào để loại sử dụng brand
chủ chốt của từ điển?
cách sử dụng tính năng này trong swift2? –