- (BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)application
{
return YES;
}
Close a Mac OS X app
-
13-01-2022 - |
Question
I've created a Mac OS X application, and during the development it was fine because I opened it with Xcode.
But now, I try to execute the executable and it's working only the first time, because after close the window, the app persists in memory. And I have to kill it with the activity monitor.
So what should I do to kill the app when I touch the red top left button on the window?
Solution
OTHER TIPS
Override the windowWillClose method in your delegate to make it terminate the app.
- (void)windowWillClose:(NSNotification *)aNotification {
[NSApp terminate:self];
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow