简体   繁体   English

如何更改NSTableColumn的背景?

[英]How can I change the background of a NSTableColumn?

I need to change the background of specific columns in my NSTableView (on mac). 我需要更改我的NSTableView中的特定列的背景(在Mac上)。

Should I change it at column level or cell level? 我应该在列级别还是单元格级别更改它?

thanks 谢谢

You can change the color for each of the cells in that column. 您可以更改该列中每个单元格的颜色。 Something kind of like: 有点像:

- (NSView*)tableView:(NSTableView*)tableView viewForTableColumn:(NSTableColumn*)tableColumn
              row:(NSInteger)row
{
    //make cell
    ...
    if([tableColumn.identifier isEqual:@(0))
    {
        cellView.drawsBackground = YES;
        cellView.backgroundColor = [NSColor lightGrayColor];
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM