Lion 以前的版本可用于恢复,但执行恢复后 UI 绑定未更新

发布于 2024-12-02 02:56:29 字数 152 浏览 1 评论 0原文

我目前正在开发一个应用程序,并且绞尽脑汁地认为以前的版本无法工作;然而,事实证明,关闭文档窗口并在恢复后重新打开,现在会显示恢复的值。

执行恢复后出现问题,UI 根本不反映恢复已发生。

有谁知道为什么会这样/如何解决这个问题?

谢谢, 克林特

I'm working on an app currently, and was scratching my head thinking that previous versions wasn't working; however it turns out that closing the document window and re-opening after a restore the restored values are now displayed.

The problem arises after performing the restore, the UI simply doesn't reflect that a restore has taken place.

Does anybody know of why this could be / how to fix the issue?

Thanks,
Clint

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

夏日浅笑〃 2024-12-09 02:56:29

您是否实现了 恢复 Windows UI 状态所需的 API?如果您不知道我在说什么,您需要阅读 文档的此部分

Have you implemented the required API for restoring the UI state of your windows? If you don't know what I'm talking about, you need to read this section of the documentation.

若沐 2024-12-09 02:56:29

事实证明,它与 RestoreFromCoder 等无关。

这是每次都会标记文档对象的地方,这不会更新 UI,因为设置属性时会执行 UI 更新,从而导致绑定无效。

我解决这个问题的方法是,每次从文档加载时,它只是将新的文档对象值“同化”到现有的值中(在 init 中初始化为默认值);这会导致用户恢复时 UI 无缝更新。

Turns out, it had nothing to do with the restoreFromCoder etc.

It was where the document object was being stamped over each time, this doesn't update the UI as UI updates a performed when a property is set, thus resulting in the binding being invalidated.

The way I got around this, was by every time it loads from a document, it simply "assimilates" the new document objects values into the existing ones (initialised to defaults in init); this results in the UI updating seamlessly when the user restores.

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