문제

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?

도움이 되었습니까?

해결책

- (BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)application
{
return YES;
}

다른 팁

Override the windowWillClose method in your delegate to make it terminate the app.

- (void)windowWillClose:(NSNotification *)aNotification {
    [NSApp terminate:self];
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top