On Feb 22, 2017, at 17:45 , David Delmonte <ddelmo...@mac.com> wrote:
> 
> It's cell based!

In that case, you need to implement the delegate method 
"tableView(_:willDisplayCell:for:row:)”, which is called once for each cell 
that’s redrawn.

In your method, you need to verify that the cell is of the type you expect (a 
NSTextFieldCell, I’m guessing), cast it to the correct type, and then set its 
backgroundColor property. Note that NSCell does not itself have such a 
property, it’s only implemented by specific subclasses.

Alternatively, it is possible to prepare one cell per color at initialization, 
then supply the correctly colored cell at each row/column. This is slightly 
more efficient, because it doesn’t involve re-configuring the cell each time 
it’s used, but it’s a bit more code (also in the delegate).




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to