iPhone/iPad 键盘快捷键?
我的程序中有一个操作,用户需要非常频繁地执行(每个会话可能执行数百次),我想为使用蓝牙键盘的用户添加键盘快捷键。有什么办法可以做到这一点吗?
现在,我最接近的是每当输入 U+F8FF 字符时触发操作(Shift+Alt+k iPad/iPhone/Mac,在文本视图中打印苹果徽标字符)。当然,如果用户确实想要输入苹果符号,这就会出现问题。
有没有更好的方法来支持键盘快捷键(希望 Cmd+something,而不是 Shift+Alt+< em>某事)?谢谢!
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. 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)? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Mac OS X 的 Cocoa 下,您可以从传递给 NSResponder 对象中的 keyDown: 方法的 NSEvent 中收集修饰键信息。 CocoaTouch 用 UIResponder 替换 NSResponder,用 UIEvent 替换 NSEvent。 UI 版本没有记录的键盘事件支持。我猜测 Apple 已经扩展了 UIResponder 来处理 keydown 事件,但尚未公开记录这些更改。不幸的是,这意味着我们只能等待该文档才能读取修饰键。
我认为您当前的解决方案是一个很好的解决方案,直到 Apple 为我们提供支持 UIResponder 的键盘。
Under Cocoa for Mac OS X, you would gather modifier key information from the NSEvent passed to the keyDown: method in an NSResponder object. CocoaTouch replaces the NSResponder with UIResponder and NSEvent with UIEvent. The UI versions don't have documented keyboard event support. I'm guessing that Apple has extended UIResponder to handle keydown events, but hasn't publicly documented the changes yet. 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.