Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The Quit menu item



On Saturday, December 29, 2001, at 04:26 PM, Ben Mackin wrote:
How do I add in some "cleanup" code so that everything exits as it
should?

Implement an -applicationShouldTerminate: method in your app's delegate.


- (void)applicationWillTerminate:(NSNotification *)aNotification

Sent by the default notification center immediately before the application terminates. aNotification is always an NSApplicationWillTerminateNotification. You can retrieve the NSApplication object in question by sending object to aNotification. Put any necessary cleanup code in this method.

applicationWillTerminate: does not get called for logout for power-off. See NSWorkspaceWillPowerOffNotification, which is sent for these events.

See Also: - applicationShouldTerminate:, - terminate:

-jcr

"Scientology is both immoral and socially obnoxious... it is
corrupt, sinister and dangerous." - Mr. Justice Latey, London 1984


References: 
 >The Quit menu item (From: email@hidden (Ben Mackin))



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.