obj-c IOS detect capslock keypress event

1.4k Views Asked by At

I'm writing my own buttons for special chars, which are not included in the native iOS keyboard. These buttons appear above the native keyboard. And some of my buttons need to determine if capslock is pressed. Is it possible to detect the capslock keypress event?

2

There are 2 best solutions below

0
On

There isn't any official API that gives you access to the directly keyboard press event or notification. You must found for another way. of to do this, is to put a transparent button over top the each key, and detect that, and then pass on the touch to the underlying button.

Another way is to handle using UITextView delegate.

refer a this link: detect/get notification if shift key (modifier-key) pressed in uitextview

1
On

Unable to detect caps-lock key-press event in iOS.

The only way you can do something like that is to create your own keyboard class or find a custom implementation online.

Note:Making the Capslock button of the Keyboard to OFF Mode

testTxtField.autocapitalizationType = NO;