简体   繁体   English

如何将操作与键盘快捷键关联?

[英]How to associate an action to a keyboard shortcut?

I've an IBAction that calls up a panel. 我有一个调用面板的IBAction。 I want to invoke that action with a keyboard shortcut but I'm at a loss on how to do it. 我想用键盘快捷键调用该动作,但我对如何操作感到茫然。

I guess one way of doing it would be to create a menu item, associate the action to the item and then assign the shortcut to that item, but I haven't done my menus yet. 我想这样做的一种方法是创建一个菜单项,将动作与项关联,然后将快捷方式分配给该项,但我还没有完成我的菜单。

Any ideas or suggestions? 任何想法或建议?

I guess one way of doing it would be to create a menu item, associate the action to the item and then assign the shortcut to that item, but I haven't done my menus yet. 我想这样做的一种方法是创建一个菜单项,将动作与项关联,然后将快捷方式分配给该项,但我还没有完成我的菜单。

I think you anwered the question yourself :) 我想你自己解决了这个问题:)
Just create a UI Element in Interface Builder that's supposed to start your Action and assign an Key Equivalent . 只需在Interface Builder中创建一个UI元素,该元素应该启动您的Action并指定一个Key Equivalent

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM