Nam
Nam

Reputation: 163

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'.

Is there a way to handle UIKeyCommand with all uppercase and lowercase characters?

Upvotes: 0

Views: 336

Answers (2)

Malik
Malik

Reputation: 3802

The reason is that you only look for 77 which is ASCII code for M. In order to allow m, you need to add 109 as well

Upvotes: 1

Dattatray Deokar
Dattatray Deokar

Reputation: 2113

You can add command for both Upper case Character and lowercase character

Upvotes: 1

Related Questions