NSEvent:仅测试一个 modfierkey
好的,我了解如何从 NSEvent 确定是否按下了修饰键:
if ([theEvent modifierFlags] & NSAlternateKeyMask) {
// The Option/Alt key was pressed
}
但这也会同时捕获选项键和另一个修饰键,例如 Option+Shift,或与选项键的任何组合。
如何仅测试选项键而不测试其他内容?
Ok, I understand how to determine from an NSEvent if a modifierkey is pressed :
if ([theEvent modifierFlags] & NSAlternateKeyMask) {
// The Option/Alt key was pressed
}
But this also captures the optionkey and another modifierkey at the same time, eg Option+Shift, or any combination with the optionkey.
How do I test for only the optionkey and nothing else?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
像这样:
Like this:
你也可以尝试
You can also try