objective-ccocoansdocumentnssavepanel

Customising NSDocument's NSSavePanel


As I edit and then try to close a document in my document-based app, an NSSavePanel pops up. It says, "Do you want to save the changes made to the document “Untitled”?"

Is there any way to alter this message? -setMessage: does not do anything, apple's sample code called CustomSave apparently uses that method without any apparent effect.


Solution

  • Apple's technical support :

    Overriding "autosavesInPlace” that returns YES changes the UI behavior of the unsaved changes save dialog, you can’t override the message string in that case. I recommend you continue to adopt auto save in place as this is more common now for document-based Cocoa apps.

    Saving on an unnamed document for the first time will allow for your message string to appear in the save dialog, but a "close operation" of an unnamed document, the save changes alert string becomes part of the save dialog near the top, not allowing for room for your message string.