Change the color and font size of NSTableView and row height

I spent several hours to find how to do this, all topics are discussed by iOS, not Mac, I want to control the table title by changing the height, background color, font, etc., like in another table. Cell ... any body helps me please!

I did the code below to change the heading for column 0, but the result would be: a heading with the text "name", but without color and line height!

NSTableHeaderCell *cell = [[NSTableHeaderCell alloc]initTextCell:@"name"];

[cell setBackgroundColor:[NSColor redColor]];

[cell drawWithFrame:NSMakeRect(0, 0, 20, 30) inView:[[tableView tableColumns] objectAtIndex:0]];

[[[tableView tableColumns] objectAtIndex:0] setHeaderCell:cell];

also i tried using this

NSTableHeaderView *headerView = [[NSTableHeaderView alloc]initWithFrame:NSMakeRect(0, 0, 120, 60)];
[tableView setHeaderView:headerView];

But I have the same original title with my custom view in reverse (both)

+4
source share
1 answer

I think you should look at the NSTableColumn setHeaderCell method :

, .

0

Source: https://habr.com/ru/post/1526438/


All Articles