NSMenuItems 消失的问题
我在 Interface Builder 中禁用了应用程序主菜单的“自动启用菜单项”,因为我需要在加载某些视图时禁用某些菜单。不过我遇到了问题。每当我的应用程序与另一个应用程序(例如 Safari)通信时,所有菜单都会被禁用,我必须强制退出并重新启动该应用程序。什么可能导致这种情况发生?
I disabled "auto-enables menu items" for my app's main menu in Interface Builder because I need to disable some menus when certain views are loaded. I am running into a problem though. Whenever my application communicates with another application (e.g. Safari) all the menus become disabled and I have to force-quit and restart the application. What could be causing this to happen?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将“自动启用项目”保留为打开状态,并禁用您需要通过第一响应者(或指定目标)中的
NSUserInterfaceValidations
协议中的-validateUserInterfaceItem:
按需禁用的项目。http: //developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/UIValidation/UIValidation.html#//apple_ref/doc/uid/10000040i
Leave "Auto Enables Items" on and disable the items you need to disable on-demand via
-validateUserInterfaceItem:
from theNSUserInterfaceValidations
protocol in your first responder (or designated target).http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/UIValidation/UIValidation.html#//apple_ref/doc/uid/10000040i