Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terminating an application when closing the window

I'm a little bit new to Objective-c with xCode, and I would like to know something. Is there a way to terminate an application when the red circle in the left of the window is clicked? Like on the calculator.

like image 358
TheNerdyCoder Avatar asked Nov 28 '22 08:11

TheNerdyCoder


1 Answers

Yes you can do with Mac OSX applications.

You need to implement this method in your AppDelegate class

 - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender{
    return YES;
}
like image 75
Anoop Vaidya Avatar answered Dec 12 '22 16:12

Anoop Vaidya