How can I handle shortcuts when LSUIElement is set to YES?
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.
精彩评论