Recognize when user close a window (when click on close button)
cocoa, macos, nswindow, objective-c, xcode
Solution
I use it in a viewcontroller
//initWithNibName
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowWillClose:) name:NSWindowWillCloseNotification object:self.view.window];
- (void)windowWillClose:(NSNotification *)notification
{
NSWindow *win = [notification object];
//...
}
Problem
How can i recognize when user close a window ? i want to do something before window close.