color row table view
color row table view
- Subject: color row table view
- From: "Tony S. Wu" <email@hidden>
- Date: Wed, 5 Mar 2003 10:32:23 -0800
I did a search on the archives for color row table view, the search
comes up with some codes from Norbert:
- (void)drawRow: (int)rowIndex clipRect: (NSRect)clipRect
{
NSColor *bgColor;
if (![self isRowSelected: rowIndex])
{
if (delegateRespondsToTableViewBackgroundColorForRow)
{
bgColor = [[self delegate] tableView: self
backgroundColorForRow: rowIndex];
if (bgColor != nil)
{
NSLog(@"%@ %@ %@", NSStringFromRect([self rectOfRow:
rowIndex]), NSStringFromRect(clipRect),
NSStringFromRect(NSIntersectionRect([self rectOfRow: rowIndex],
clipRect)));
[[NSColor blackColor] set];
[[NSBezierPath bezierPathWithRect:
NSIntersectionRect([self rectOfRow: rowIndex], clipRect)] stroke];
[bgColor set];
NSRectFill(NSIntersectionRect([self rectOfRow:
rowIndex], clipRect));
NSRectFill([self rectOfRow: rowIndex]);
}
}
}
[super drawRow: rowIndex clipRect: clipRect];
}
- (void)setDelegate: (id)aDelegate
{
[super setDelegate: aDelegate];
delegateRespondsToTableViewBackgroundColorForRow =
[[self delegate] respondsToSelector:
@selector(tableView:backgroundColorForRow:)];
}
However, only the first 2 columns of my table view gets full background
color.
The others are only "stroked".
I then try to make all my table view's data cell has no background.
Now all columns get full background, but those rows that i don't want
background now gets stroked...
Can anyone tell me what i did wrong?
Tony S. Wu
email@hidden
"The world doesn't give us hope - it gives us chance."
http://homepage.mac.com/tonyswu/tonyswu - My web page.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.