docs:programming:cocoa_and_objective-c:quit_on_close

quit on close

This is to make the application automatically quit when the user closes the last window, as opposed to requiring the user to still select quit from the menu when nothing is left on the screen

  • make a class (such as MyAppController) the delegate of File's Owner in Interface Builder
  • override the following method as shown:
    //--------- Application Delegate Methods ---------//
    // this causes the application to quit after the window is closed
    // (after connecting AppController to "File's Owner" as a delegate
    - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
    {
    	return YES;
    }
  • docs/programming/cocoa_and_objective-c/quit_on_close.txt
  • Last modified: 2008/08/03 00:25
  • by 127.0.0.1