如何在手动绑定中更新窗口控件(NSTextField、NSCheckbox 等)

发布于 2024-09-02 15:56:17 字数 228 浏览 2 评论 0原文

我正在开发一个应用程序,其中我需要将所有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一个人的旅程 2024-09-09 15:56:17

此处阅读本指南

您需要在 特别阅读“自动与手动支持”部分,其中详细介绍了您需要如何更改属性以便符合 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文