I've been using the following to create an array from a plist of dictionaries:
self.cough = [NSMutableArray arrayWithCapacity:[ailments count]];
NSDictionary* dict;
for (dict in ailments)
if ([[dict valueForKey:@"section"]isEqualToString:@"coughing"])[cough addObject:dict];
The format of the plist is:
section: coughing
name: Common Cold
The trouble I'm having, and I suspect its an easy one is, if I want to have "Common Cold" in a different section, like "Headache", I could create another ailment object for the new section but it messes up my search result by showing 2 Common Cold entries (from both "Coughing" and "Headache").
What I'd like to do is:
section: coughing, headache
name: Common Cold
What would I use instead of isEqualToString:
to create two different arrays, one for "Coughing" and another for "Headache"?