How to get a unique value based on the dictionary key, which is the element of an array in Objective-C?
For example:
I have an array of items
aryItem
aryItem [0] = Dictionary {Itemcategory itemName itemprice} aryItem [1] = Dictionary {item item category name itemprice} ........... ........... aryItem [n] = dictionary {itemcategory items Itemprice}
Now I just want to get unique item characters, not duplicate. If I can write [[aryItem objectatIndex: i] valueForKey: ItemCategory] I get all the categories, it is also included in the same category. I only need unique categories. I have the option of the entire array and then the unique item category objects , But I'm looking for any short way to fulfill the same thing.
Thank you.
I think the NSSet class is most suitable to collect unique values. You can create one by creating something like this:
NSSet * categories = [NSSet Set Vitrere: [Arya Itam Mann Farki: @ "Item Category"]];
Comments
Post a Comment