How to take notice when an NSWindow
is about to be opened or have just opened? That is, the opposite of windowWillClose:
delegate method (likewise the opposite of NSWindowWillCloseNotification.
)
This is related to this question, but from the other direction.
The background is, I'm looking to couple a window with a tickmark on the main menu (among other things). When the window is shown, the corresponding ̨ menu item should be checked and vice-versa.
By macOS 10.10, this is somewhat solved by the call to
NSViewController
'sviewWillAppear
orviewDidAppear
. Have anNSViewController
subclass and set it as thecontentViewController
of the window. Then itsviewWillAppear
/viewDidAppear
implementation can post a notification that the window will (or did) open.