Populate NSTableView using NSDictionary filled with Arrays

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

  1. klaxamazoo macrumors 6502

    Sep 8, 2006
    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


    Jan 10, 2005
    Dallas, TX
    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.

  3. klaxamazoo thread starter macrumors 6502

    Sep 8, 2006
    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