iphone - Accessing NSDictionary inside NSArray -
i have nsarray
of nsdictionary
. each dictionary in array has 3 keys: 'name', 'sex' , 'age'
how can find index in nsarray
of nsdictionary
where, example, name = 'roger'
?
nsuinteger count = [array count]; (nsuinteger index = 0; index < count; index++) { if ([[[array objectatindex: index] objectforkey: @"name"] isequaltostring: @"roger"]) { return index; } } return nsnotfound;
Comments
Post a Comment