Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

abcdefg12345

macrumors 6502
Original poster
Jul 10, 2013
281
86
I set the background colour for nswindow and for some reason its displaying the correct colour for os x 10.11 and mac os 10.12, however its displaying white background for os x 10.10, anyone know how to fix it.


Code:
override func awakeFromNib() {
        window.backgroundColor = NSColor(deviceRed: 0.10, green: 0.74, blue: 0.61, alpha: 1)
}

I'm using Xcode 7.3.1 on os x 10.11.6
 
I would try to do this in the function windowControllerDidLoadNib:


Code:
- (void) windowControllerDidLoadNib:(NSWindowController *) aController
{
   [super windowControllerDidLoadNib: aController];
   
//your code here
}

if that fails, try:

Code:
- (id)init
{
   self = [super init];
  if (self) {
  // Add your subclass-specific initialization here.
  // If an error occurs here, send a [self release] message and return nil.
  }
return self;
}

windowControllerDidLoadNib is called after the object has been successfully loaded from the nib file and it gives you an opportunity to do things like the set the background color. Also look at

Code:
[object setNeedsDisplay: YES];
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.