Kristina Brooks Kristina Brooks - 1 year ago 127
Objective-C Question

Make a Cocoa application quit when the main window is closed?

How to make a Cocoa application quit when the main window is closed? Without that you have to click on the app icon and click quit in the menu.

Answer Source

You can implement applicationShouldTerminateAfterLastWindowClosed: to return YES in your app's delegate. But I would think twice before doing this, as it's really unusual on the Mac outside of small "utility" applications like Calculator and most Mac users will not appreciate your app behaving so strangely.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download