0

I'm developing a Cocoa App (OSX) and, in my tableview, I want to change the font of all of my columns.

I'm using the cell-based version.

Strangely, It is not possible to do it by using Interface Builder (IB). Each time, it forces me to use the font "System Small" !

But, if I activate the "hidden" checkbox, It allows me to change the font! So stupid!

So in my code (a derived class of NSTableView) I change the font of all my columns like that :

[ self.tableColumns forEachWithIndex:^( NSTableColumn * tableColumn, NSUInteger index, BOOL * stop )   {
    ...
    NSTableHeaderCell * tableHeaderCell = [ [ NSTableHeaderCell alloc ] initTextCell:@"TEST" ];
tableHeaderCell.font = [ NSFont boldSystemFontOfSize:16 ];

[ tableColumn setHeaderCell:tableHeaderCell ];

But, the font is always the small font on OSX El Capitan 10.11.4 : Result on El Capitan

Whereas, the same code in Yosemite displays the correct font :

Result on Yosemite

I don't understand why?

Is there a specific thing to do in El Capitan with NSCell?

Thanks for any help.

Chrstpsln
  • 765
  • 16
  • 31
  • Did you find something out about this? – ctietze Jun 09 '16 at 06:30
  • @ctietze No, for the moment, the only solution is to test whether you are on Yosemite or El Capitan, and if so change the font manually. I posted a bug in iTunes with a code sample, but I never received a response from them. – Chrstpsln Jun 09 '16 at 09:16
  • Hmm. My only successful attempt was to write custom drawing code, too -- even for the background color. I wonder if the cell-based stuff will go away in the future. – ctietze Jun 11 '16 at 05:50

0 Answers0