[英]How to handle uppercase and lowercase characters when using UIKeyCommand
We are in the process of receiving and processing keyboard input. 我们正在接收和处理键盘输入。
Among my source code, 在我的源代码中,
UIKeyCommand *menuKey = [UIKeyCommand keyCommandWithInput:[NSString stringWithFormat:@"%c", 77]
modifierFlags:0
action:@selector(menuKey:)];
There is this part. 有这部分。
However, if you process it like this, it will only react when it is an uppercase 'M', and it does not respond when it is a lowercase 'm'. 但是,如果以这种方式处理它,则仅当它是大写字母“ M”时才会响应,而当它是小写字母“ m”时它不会响应。
Is there a way to handle UIKeyCommand with all uppercase and lowercase characters? 有没有一种方法可以处理所有大写和小写字符的UIKeyCommand?
您可以为大写字母和小写字母添加命令
The reason is that you only look for 77
which is ASCII code for M
. 原因是您只寻找77
,这是M
ASCII码。 In order to allow m
, you need to add 109
as well 为了允许m
,您还需要添加109
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.