开发者

Hotkeys? Key events?

I'm trying to make a window open when the user 开发者_运维知识库pressed Cmd + L but how can I make my controller object listen to that particular key combination?


Create a menu item, set its shortcut to Cmd-L, and connect it to an action on that controller (or on another controller, which forwards to your desired controller).

Or ... read the Handling Key Events section of the Cocoa Event-Handling Guide and implement a custom view that, when it is the first responder, interprets this key event and notifies your controller.

Or ... insert your controller into the responder chain.

... but the easiest method is the first I mentioned.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜