I cannot seem to find it in the documentation but I'm looking for a way to run a method whenever a window is displayed on screen af开发者_如何学Pythonter launch of my app or after it has been closed and then reopened again.
You could try using NSWindowDidBecomeKeyNotification
or NSWindowDidBecomeMainNotification
. These are called when the window becomes key/main rather than when it's put on-screen, but most windows are made key/main when they go on-screen. You could also experiment with the other NSWindow notifications (see the bottom of the documentation page for NSWindow), it's possible that some of them may be called when the window goes on-screen.
NSWindowController:
– windowDidLoad
– windowWillLoad
精彩评论