tableview 设置标题

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

posted on 2013-03-24 15:46  陌上有缘  阅读(361)  评论(0编辑  收藏  举报