2015-08-30 15 views

回答

1

在你NSWindow委托:

func windowDidBecomeMain(notification: NSNotification) { 
    let theView = ... 
    theView.needsDisplay = true 
} 

func windowDidResignMain(notification: NSNotification) { 
    let theView = ... 
    theView.needsDisplay = true 
} 

在你NSView子类:

func drawRect(rect: NSRect) { 
    if self.window.isMainWindow { 
     // draw active appearance 
    } else { 
     // draw inactive appearance 
    } 
}