In my application I have an NSTableView with a custom header cell that is programatically assigned. The code to assign the custom cell looks like this:
-(void)setupTableHeader:(id)table {
NSArray *columns = [table tableColumns];
NSEnumerator *cols = [columns objectEnumerator];
NSTableColumn *col = nil;
TRDarkTableColumnHeaderCell *iHeaderCell;
while (col = [cols nextObject]) {
iHeaderCell = [[TRDarkTableColumnHeaderCell alloc] initTextCell:[[col headerCell] stringValue]];
[col setHeaderCell:iHeaderCell];
[iHeaderCell release];
}
}
This works as you'd expect. However, when my window is resized and the NSTableView renders its scrollbars, an additional header cell is created with the default NSTableHeaderCell. To attempt to handle this, I tried to setup a notification to fire on window resize. Unfortunately, this has no effect (my setupTableHeader function still returns 1 column for the table)
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setupTableHeaders) name:NSWindowDidResizeNotification object:[[NSApp delegate] window]];
Note that my notification calls a helper function setupTableHeaders, which calls the setupTableHeader function mentioned above. Here's a screenshot to illustrate the issue: