Populate NSTableView using NSDictionary filled with Arrays

Discussion in 'Mac Programming' started by klaxamazoo, Sep 1, 2011.

  1. klaxamazoo macrumors 6502

    Joined:
    Sep 8, 2006
    #1
    I've been having trouble and haven't managed to find a clear solution from documentation.

    I have an NSDictionary object called "allValuesDictionary" that contains a bunch of arrays. Is it possible to use bindings to populate an NSTableview?

    I've looked into NSDictionaryController and NSArrayController but I think I'm doing something wrong when I try and bind the controller to the tablecolumns.
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    Can you describe your data a little more? Is it something like:
    {keyOne => [valOne,valTwo,valThree]
    keyTwo => [valFour,valFive,valSix]}

    With keyOne and keyTwo as your column headers, with three rows of data?

    If so, this is opposite of what I'm used to seeing:
    [
    {keyOne => valOne, keyTwo => valFour},
    {keyOne => valTwo, keyTwo => valFive},
    {keyOne => valThree , keyTwo => valSix}
    ]

    ({} contains dictionary pairs, [] contain arrays.

    I'm honestly not sure about bindings, but array of hash/dictionary is much more common.

    -Lee
     
  3. klaxamazoo thread starter macrumors 6502

    Joined:
    Sep 8, 2006
    #3
    I was trying to do the first method:

    {keyOne => [valOne,valTwo,valThree]
    keyTwo => [valFour,valFive,valSix]}

    where each key was tied to an NSArray and I wanted to populate the table with the arrays.

    I'll look into the hash dictionary.
     

Share This Page