Reputation:
Can Anyone give a list of NWSWindow events sequence when NSWindow closes. More specifically which is the last notification that a NSWindow that closes sends. Apple docs are very sparse on any sequence stuff.
Upvotes: 0
Views: 160
Reputation: 8180
The messages sent to a window when closing are – windowShouldClose: and – windowWillClose:. These are sent to the window's delegate and conform to the NSWindowDelegate protocol. Also you can register to receive NSWindow's notifications such as NSWindowWillCloseNotification.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowWillCloseNotification:) name:NSWindowWillCloseNotification object:self.window];
- (void)windowWillCloseNotification:(NSNotification*)notification
{
// ... do something, save information...
NSWindow *window = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowWillCloseNotification object:window];
}
Upvotes: 1