Re: NSOutlineView and background color
Re: NSOutlineView and background color
- Subject: Re: NSOutlineView and background color
- From: Stefan Arentz <email@hidden>
- Date: Mon, 4 Jun 2001 14:00:04 +0200
On Sun, Jun 03, 2001 at 10:42:44PM -0700, Steve Gehrman wrote:
>
I would like to make my NSOutlineView look just like iTunes with
>
alternating blue and white rows.
>
>
I can't seem to find a way to do this. Please help!
- (void) tableView: (NSTableView*) aTableView willDisplayCell: (id) aCell
forTableColumn: (NSTableColumn*) aTableColumn row: (int) aRowIndex
{
if ((aRowIndex % 2) == 0) {
[aCell setDrawsBackground: YES];
[aCell setBackgroundColor: [NSColor colorWithCalibratedRed: 0.90 green: 0.90 blue: 0.80 alpha: 1.0]];
} else {
[aCell setDrawsBackground: NO];
[aCell setBackgroundColor: [NSColor whiteColor]];
}
}
Please note that this can be optimized by keeping the color around. Do you have
good code to draw the divider lines? The grid doesn't seem to work here :-/
Stefan