Dark Mode for NSTableView

I am updating my Mac app to support Dark Mode. I am having trouble with NSTableViews. On two of my views it is working fine, but on others it is still showing as white background with black text.


I wish this forum supported images(why not?) Anyway, I have set the Grid color to Default(Gridn Color) and the Background to Default(Control Background Color) and it looks fine in Interface Builder. It is set this way in both the table views that work and those that don't. When running the app, the non-working table views have a white background and black text. Also, I have checked every other setting in attributes inspector and they are also the same.

Accepted Reply

OK, figured it out. I had this line in the windowDidLoad method of my NSWindowController:


self.window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];


Removed that line and the table and outliner views work now


Replies

Did you watch WWDC 2018 Video ?


In session 210, @ 56:20, they show a setting in IB that could address your question, by setting appearance to inherited(system, dark Appearance).


Hope that may help.

I tried that. Actually, the choice is inherited(System, Dark Aqua) That doesn't work. I selected just Dark Aqua and that works, but doesn't work correcty in light mode.

OK, figured it out. I had this line in the windowDidLoad method of my NSWindowController:


self.window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];


Removed that line and the table and outliner views work now