Cancel Cocoa Doc Based app Save method?
How can I cancel the automatic display of th开发者_运维百科e Save Panel when closing windows in a doc based Cocoa app?
Thanks
Paul
Try overriding -isDocumentEdited
. This works for all open docs and is much simpler and safer than overriding canCloseDocumentWithDelegate
or canCloseAllDocumentsWithDelegate
.
- (BOOL) isDocumentEdited
{
return NO;
}
For control on a per-window basis, override -canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:
There's also similar methods on NSDocumentController for when there's more then one document with unsaved changes.
Agreed with Barry though, this is generally a bad idea.
精彩评论