开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜