How to change NSTableView column title programmatically ?
11/11/05 21:55
How to change the title of column and reflect the change without the need to reload the data ?
[[myTableColumn headerCell] setStringValue:myNewTitle] ;
[[myTableView headerView] setNeedsDisplay:YES];
You could also put that code in a NSTableColumn category for easy re-use:
@interface NSTableColumn(SetTitle)
- (void)setTitle:(NSString *)inTitle
{
[[self headerCell] setStringValue:inTitle] ;
[[[self tableView] headerView] setNeedsDisplay:YES];
}
@end
[[myTableView headerView] setNeedsDisplay:YES];
You could also put that code in a NSTableColumn category for easy re-use:
@interface NSTableColumn(SetTitle)
- (void)setTitle:(NSString *)inTitle
{
[[self headerCell] setStringValue:inTitle] ;
[[[self tableView] headerView] setNeedsDisplay:YES];
}
@end