开发者

How can I handle shortcuts when LSUIElement is set to YES?

开发者 https://www.devze.com 2023-02-15 04:34 出处:网络
When LSUIElement is set to NO most of s开发者_如何学运维hortcuts are handled by application\'s main menu. But when LSUIElement is set to YES, there is no main menu and then no common shortcuts are for

When LSUIElement is set to NO most of s开发者_如何学运维hortcuts are handled by application's main menu. But when LSUIElement is set to YES, there is no main menu and then no common shortcuts are forwarded to a first responder.

The naive solution would be overriding performKeyEquivalent: for each view/window class. But I only want to handle common shortcuts, not special one. So, I'm looking for a better solution.


I found this http://cocoa.flyingmac.com/2010/07/cut-copy-and-paste-in-lsuielement-applications/. But that doesn't seem like it's what you want and I guess could just be a last resort. That guide just illustrates how to manually implement the keyboard shortcuts yourself.

EDIT: Just implemented this into one of my apps and it works perfectly.

0

精彩评论

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