简体   繁体   English

iPhone / iPad键盘快捷键?

[英]iPhone/iPad keyboard shortcuts?

There's an action in my program which users need to perform very frequently (potentially hundreds of times per session), and I'd like to add a keyboard shortcut for users with a bluetooth keyboard. 我的程序中有一个动作,用户需要非常频繁地执行(每个会话可能有数百次),我想为使用蓝牙键盘的用户添加键盘快捷键。 Is there any way to do this? 有没有办法做到这一点?

Right now, the closest I've come is triggering the action whenever the U+F8FF character is entered ( Shift + Alt + k on an iPad/iPhone/Mac, which prints an apple logo character) in a text view. 现在,我最接近的是在文本视图中输入U + F8FF字符(iPad / iPhone / Mac上的Shift + Alt + k ,打印苹果徽标字符)时触发操作。 Of course, this would present an issue if the user actually wanted to input an apple symbol. 当然,如果用户实际想要输入苹果符号,这将会出现问题。

Are there any better ways to support keyboard shortcuts (hopefully Cmd + something , rather than Shift + Alt + something )? 有没有更好的方法来支持键盘快捷键(希望Cmd + 东西 ,而不是Shift + Alt +的东西 )? Thanks! 谢谢!

Under Cocoa for Mac OS X, you would gather modifier key information from the NSEvent passed to the keyDown: method in an NSResponder object. 在Cocoa for Mac OS X下,您将从传递给NSResponder对象中的keyDown:方法的NSEvent收集修饰符键信息。 CocoaTouch replaces the NSResponder with UIResponder and NSEvent with UIEvent. CocoaTouch用UIResponder替换NSResponder,用UIEvent替换NSEvent。 The UI versions don't have documented keyboard event support. UI版本没有记录的键盘事件支持。 I'm guessing that Apple has extended UIResponder to handle keydown events, but hasn't publicly documented the changes yet. 我猜测Apple已经扩展了UIResponder来处理keydown事件,但还没有公开记录这些变化。 Unfortunately that means we'll just have to wait for that documentation to be able to read the modifier keys. 不幸的是,这意味着我们只需等待该文档就能够读取修饰键。

I think your current solution is a fine solution until Apple gives us a keyboard supporting UIResponder. 我认为您当前的解决方案是一个很好的解决方案,直到Apple为我们提供支持UIResponder的键盘。

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

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