I have some code to do this (which is below) but I get one error stopping it from working and the error is ''MyOutlineView' may not respond to '-objectArray'', it says that it needs to be declared but I don't know what code I should use in the Header File to declare it.
The Code:
- (void) outlineView: (NSOutlineView *) aView
willDisplayCell: (id) aCell
forTableColumn: (NSTableColumn *)aColumn
item: (id) anItem
{
id rootObj = anItem;
unsigned row = [aView rowForItem:anItem];
[aCell setDrawsBackground: YES];
while ([aView levelForRow:row] != 0) {
row --;
rootObj = [aView itemAtRow:row];
}
// The colours here are foul and ugly. Use something else, for
// God's sake!
if ([[self objectArray] indexOfObject:rootObj] % 2)
[aCell setBackgroundColor: [NSColor yellowColor]];
else
[aCell setBackgroundColor: [NSColor blueColor]];
}