Array of NSDictionaries

Discussion in 'Mac Programming' started by BollywooD, Oct 2, 2009.

  1. macrumors 6502

    Joined:
    Apr 27, 2005
    Location:
    Surfers Paradise
    #1
    so I have an NSArray of NSDictionaries, and I would like to return an NSArray of keys from these dictionaries.


    where do I start?
     
  2. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    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
     
  3. macrumors 601

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #3
    NSDictionary has a method allKeys: and then you can combine the arrays using NSMutableArray's addObjectsFromArray:
     
  4. thread starter macrumors 6502

    Joined:
    Apr 27, 2005
    Location:
    Surfers Paradise
    #4
    All the dictionaries do have the same keys
     

Share This Page