iphone - Grab all values in NSDictionary inside an NSArray -
i have nsarray full of nsdictionary objects, , each nsdictionary has unique id inside. want lookups of particular dictionaries based on id, , information dictionary in own dictionary.
myarray contains:
[index 0] mydictionary object name = apple, weight = 1 pound, number = 294, [index 1] mydictionary object name = pear, weight = .5 pound, number = 149, [index 3] mydictionary object (etc...)
i want name , weight second dictionary object (i won't know index of object... if there 2 dicts, make dictionary [myarray objectatindex:1]
)
so, know number 149. how able second mydictionary object out of myarray new nsdictionary?
as alternative jacob's answer, ask dictionary find object:
nspredicate *finder = [nspredicate predicatewithformat:@"number = 149"]; nsdictionary *targetdictionary = [[array filteredarrayusingpredicate:finder] lastobject];
Comments
Post a Comment