NSMenuItem 隐藏绑定问题
我有一个 NSMenuItem,我已将其绑定到 IB 中的 NSUserDefaults 布尔值。
当变量 bMenuHidden 为 true 时,我希望隐藏我的 NSMenuItem,反之亦然。这在 Snow Leopard 下按预期工作。然而,Leopard 在某些情况下会遇到困难。特别是:无论 bMenuHidden 的值如何,我的 NSMenuItem 在首次启动应用程序时都是可见的。我已通过属性列表编辑器验证该值是否存在、具有布尔类型并且设置为 true。
诚然,我对“占位符”值没有太多经验(Apple 文档在这方面有点令人困惑),但我已将所有内容设置为默认为“是”(在这些情况下隐藏菜单,因为最好是安全胜于遗憾):
我做错了什么?
I have an NSMenuItem which I have bound to an NSUserDefaults boolean value in IB.
When the variable bMenuHidden is true, I would like my NSMenuItem to be hidden, and vice versa. This works as expected under Snow Leopard. However, Leopard struggles in some cases. In particular: my NSMenuItem is visible upon first launching the application, regardless of the value of bMenuHidden. I've verified via Property List Editor that the value is present, has a Boolean type, and is set to true.
Admittedly, I don't have much experience with 'placeholder' values (the Apple documentation is a little confusing on the matter), but I've set everything to default to Yes (hide the menu in these cases, as it's better to be safe than sorry):
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论