简体   繁体   中英

How to associate an action to a keyboard shortcut?

I've an IBAction that calls up a panel. 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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