ios - Retrieve NSDictionary from NSArray where dictionary key has value X -
i have nsarray
nsdictionaries
. 1 of dictionaries keys in 1 of arrays contains value. want retrieve nsdictionary
value.
my array:
array: ( { displayname = "level"; internalname = "number 2"; numbervalue = 1; }, { displayname = "purchaseamount"; internalname = "number 1"; numbervalue = 3500; } )
so, dictionary contains displayname
set purchaseamount
(case insensitive).
how can accomplish that?
the following solved problem:
nsarray *filtered = [promotions filteredarrayusingpredicate:[nspredicate predicatewithformat:@"(displayname == %@)", @"purchaseamount"]]; nsdictionary *item = [filtered objectatindex:0];
thnx user nate comment on question!
Comments
Post a Comment