Hi,
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 after launch of my app or after it has been closed and then reopened again.
Hi,
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 after launch of my app or after it has been closed and then reopened again.
Is it iPhone or Mac?
Your window contains views, and they have their viewDidAppear
methods. You should use them, I think.
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.