2015-08-30 53 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 
    } 
}