Binding table view custom cell background colour

  • Hi, everyone.  I'm making a program (a periodic table, to be exact)
    that requires coloured cells (coloured button cells for the table
    itself and coloured plain cells for the legend).  I have made a
    subclass of NSButtonCell (which I've placed inside an NSMatrix
    subclass) for the periodic table itself, and the legend I have
    decided to put into an NSTableView.  The matrix works; the legend,
    however, is proving troublesome.

    The problem is this: I want to avoid really messy code, if possible,
    and stick with an MVC paradigm, if possible.  I'm having trouble
    wrapping my head around what I would have to do here, so I'm
    submitting this question to the list in the hopes that anyone else
    who has a similar problem may also be helped.  I am sure that an
    NSValueTransformer will be used, but beyond that I'm still a bit
    clueless.  To make the question more abstract:

    If one wants to make a background colour appear for an NSCell in a
    table view, but make it unique for each NSCell (so that the first row
    is red, the second is blue, the third is green, et cetera), what is
    the best way (with an NSArrayController) to do this?

previous month october 2006 next month
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today