According to the NSTableHeaderView class reference, an NSTableHeaderView uses an NSTableHeaderCell class to implement its user interface.
NSTableHeaderView uses NSTableHeaderCell to implement its user interface.
NSTableHeaderView Class Reference
Okay, so now I subclassed my NSTableHeaderCell and did the necessary changes but how do I assign my custom NSTableHeaderCell to an NSTableHeaderView?
Try like this:
#import <Cocoa/Cocoa.h>
@interface customHeaderCell : NSTableHeaderCell
{
}
@end
#import "customHeaderCell.h"
@implementation customHeaderCell
-(id)initTextCell:(NSString *)aString
{
if([aString isEqualToString:@"yourHeaderCell"])
{
// do your stuff here;
}
return [super initTextCell:aString];
}
@end
Now in other class wherever your table view you are using write the following the code:
-(IBAction)addData:(id)sender
{
for (NSTableColumn *col in [tableView tableColumns])
{
customHeader=[[customHeaderCell alloc]initTextCell:[col identifier]];
}
}