如何在手动绑定中更新窗口控件(NSTextField、NSCheckbox 等)
我正在开发一个应用程序,其中我需要将所有 NSObject 子类属性存储到 plist 文件中,然后允许用户存储和恢复它。我们称之为配置文件,它可以恢复我的应用程序中窗口上所有控件/视图的保存状态。
我已经完成了存储/恢复部分,但问题是当我手动更新类属性时,它没有更新控件状态,例如复选框和其他与类属性绑定的控件状态。
如果 KVC/KVO 以编程方式更新,请告诉我如何更新控件状态。
提前致谢
I am working on an application in which i need to store all the NSObject subclass properties into plist file and then allow users to store it and restore it. We call it profile and it can restore the saved state of all the controls/views on the window in my application.
I have completed the storing/Restoring part, but the issue is when i am updating the class properties manually, it is not updating the control state Like checkboxs and others which is bind with the class property.
Please let me know how can i update the controls state, if its KVC/KVO updated programatically.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此处阅读本指南
您需要在 特别阅读“自动与手动支持”部分,其中详细介绍了您需要如何更改属性以便符合 KVO 要求。
You need to read this guide here
In particular read the section on "Automatic Versus Manual Support" which details how you need to change your properties so that you are KVO compliant.