使用 NSUserDefaults 存储 NSTextView 的内容
我一直在研究苹果的示例代码 - UserDefaults - http: //developer.apple.com/library/mac/#samplecode/UserDefaults/Introduction/Intro.html - 我无法让它与实例一起使用NSTextView 并通过删除记录按钮,因此我想知道如何让 NSUserDefaults 自动存储 NSTextView 的内容。
提前致谢!
I have been playing around with Apple's sample code - UserDefaults - http://developer.apple.com/library/mac/#samplecode/UserDefaults/Introduction/Intro.html - and I haven't been able to get it working with an instance of NSTextView and by removing the record button and I was therefore wondering how to get NSUserDefaults to automatically store the contents of an NSTextView.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有办法自动存储它。这是通过子类化 NSTextView 来保存内容的简单方法:
EDIT
删除
synchronize
。There's no way to store it automatically. Here's a simple way to save contents by subclassing NSTextView:
EDIT
Removed
synchronize
.