Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

BollywooD

macrumors 6502
Original poster
Apr 27, 2005
372
46
Hamburg
so I have an NSArray of NSDictionaries, and I would like to return an NSArray of keys from these dictionaries.


where do I start?
 
Do all of the dictionaries have the same keys? If so, just get the first element of the NSArray, and get the keys of the NSDictionary using allKeys. If not, for each array element get the keys and append them to an NSMutableArray with addObjectsFromArray.

-Lee
 
NSDictionary has a method allKeys: and then you can combine the arrays using NSMutableArray's addObjectsFromArray:
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.