table view header cell bottom border
table view header cell bottom border
- Subject: table view header cell bottom border
- From: Shane <email@hidden>
- Date: Wed, 25 Nov 2009 16:22:27 -0600
I read in a file, parse the contents, and then I create NSTableColumns
based on the contents of the file … and then I just
addTableColumn:newColumn to the NSTableView. I've attached a small
image of the problem I'm seeing where my border doesn't completely run
across the bottom of each of my headers cells, rather, it only works
on the first column.
Here's how I create my headers and columns ...
tableHeaderCell = [[MyHeaderCell alloc] initTextCell:columnName];
[tableHeaderCell setPullsDown:NO];
[tableHeaderCell setControlSize:NSMiniControlSize];
[tableHeaderCell setBordered:NO];
[tableHeaderCell setFont:[NSFont labelFontOfSize:
[NSFont smallSystemFontSize]]];
if (i == 0) {
[tableHeaderCell setEditable:NO];
column = [[DataTableColumn alloc]
initWithIdentifier:[NSNumber numberWithInt:i]];
}
else {
[tableHeaderCell setEditable:YES];
[tableHeaderCell addItemWithTitle:@"item1"];
[tableHeaderCell addItemWithTitle:@"item2"];
[tableHeaderCell addItemWithTitle:@"item3"];
column = [[NSTableColumn alloc]
initWithIdentifier:[NSNumber numberWithInt:i]];
}
[column setHeaderCell:tableHeaderCell];
[myTableView addTableColumn:column];
I've subclass MyHeaderCell from NSPopUpButtonCell and I draw the
borders within drawInteriorWithFrame as follows …
- (void) drawInteriorWithFrame:(NSRect) cellFrame inView:(NSView *) controlView
{
[[NSColor whiteColor] set];
[[NSBezierPath bezierPathWithRect:cellFrame] fill];
NSBezierPath *path = [NSBezierPath bezierPath];
[path moveToPoint:NSMakePoint(cellFrame.origin.x, cellFrame.size.height)];
[path lineToPoint:NSMakePoint(cellFrame.size.width, cellFrame.size.height)];
[[NSColor darkGrayColor] setStroke];
[path stroke];
[super drawInteriorWithFrame:cellFrame inView:controlView];
return;
}
Anyone see any reason why my header cells would not all be underlined?
Attachment:
columns-prob.tiff
Description: TIFF image
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden