• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Ask Before Quite,Best Way To Save INFO
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ask Before Quite,Best Way To Save INFO


  • Subject: Re: Ask Before Quite,Best Way To Save INFO
  • From: publiclook <email@hidden>
  • Date: Tue, 27 May 2003 18:09:06 -0400

See applicationShouldTerminate:



- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
Invoked from within the terminate: method immediately before the application terminates. sender is the NSApplication to be terminated. The value returned should be one of the values defined in Constants. For compatibility reasons, a return value of NO is equivalent to NSTerminateCancel, and a return value of YES is equivalent to NSTerminateNow.


See Also:  terminate:,  applicationShouldTerminateAfterLastWindowClosed:,  applicationWillTerminate:


or applicationWillTerminate:



- (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.

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

See Also:  applicationShouldTerminate:,  terminate:


In http://developer.apple.com/techpubs/macosx/Cocoa/Reference/ ApplicationKit/ObjC_classic/Classes/NSApplication.html

Implement applicationShouldTerminate: or -applicationWillTerminate: to implement a close, save, cancel or whatever panel.

NSData and NSString documentation explains how to read and write strings or arbitrary data.

There is an example in "Cocoa Programming" that implements a multi-document application without using NSDocument. It shows how to use -applicationWillTerminate: etc. There is also the TextEdit sampel already on your hard disk. It includes useful code.


On Tuesday, May 27, 2003, at 04:05 PM, Chad Eckles wrote:

Hello All i have a Single Document Interface and i want it to ask the user if he want to 'Close','Save','Cancel' can someone help me with this
also can i get some code that will help me to save and read Text from a file or a plist file because the data will be allot of information!
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Ask Before Quite,Best Way To Save INFO (From: Chad Eckles <email@hidden>)

  • Prev by Date: Re: Why multi-threading ?
  • Next by Date: Re: Cocoa litterature
  • Previous by thread: Ask Before Quite,Best Way To Save INFO
  • Next by thread: Ask Before Quite,Best Way To Save INFO
  • Index(es):
    • Date
    • Thread