Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法以某种方式将NSDocument's链接到用于文档changeCount的唯一文件?NSTextView
NSDocument
changeCount
NSTextView
或者我必须实现所有必要的NSTextViewDelegate方法并changeCount自己更新?
NSTextViewDelegate
创建基于文档的应用程序。在文档的窗口中放置一个 NSTextView 的实例。构建并运行应用程序。
在文本视图中输入一些内容。您会看到窗口的标题栏反映了文档的编辑状态。尝试撤消和重做;即使这样也行。(您仍然需要实现代码来保存文本视图的内容,但这超出了您的问题范围。)
如果您因此而担心更改计数,请回答您的问题:您无需执行任何操作。