问题描述
您好
我有一个正在构建的基于Cocoa文档的应用程序,它允许您打开单独的视图并与Webview组件进行交互。但是,无论何时与它进行交互,然后关闭应用程序,都会出现一条消息,提示:
HiI have a Cocoa document based application that I have been building, that allows you to open seperate views and interact with a webview component. However, when ever you have interacted with it, and then go to close the application, a message comes down saying:
是否要保存您在其中所做的更改?文档无标题?
如果您不保存所做的更改,您的更改将丢失。
"Do you want to save the changes you made in the document "Untitled"?"Your changes will be lost if you don’t save them."
我希望当我的申请被提交时关闭,此消息不会显示。我不需要任何自动保存或保存选项。如何防止显示此消息并将其禁用?
I wish to make it that when my application is closed, this message is not shown. I do not need any auto-saves or saving options. How do I prevent this message been shown and disable it?
在此先感谢
Sam
推荐答案
最近我有我所做的就是将以下方法放在继承NSDocument的自定义文档类中:
Recently I had the exact same wish to prevent the save dialog from showing up. What I did is put the following method in my custom document class that inherits NSDocument
-(BOOL)isDocumentEdited {
return NO;
}
这篇关于防止“退出时保存”可可文件申请退出时的对话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!