开发者

iPhone Keyboard key value return

开发者 https://www.devze.com 2022-12-19 01:23 出处:网络
I would like to know if a method like touchesBegan for touches Event exists for the iPhone keyboard. I mean 开发者_运维百科just how to know when I press a key, which value is it. (Don\'t display it on

I would like to know if a method like touchesBegan for touches Event exists for the iPhone keyboard. I mean 开发者_运维百科just how to know when I press a key, which value is it. (Don't display it on UITextfield or UILabel but display it with an NSLog for example). Is there any way?


You want the UITextFieldDelegate Protocol method:

– textField:shouldChangeCharactersInRange:replacementString:

The keyboard sends this every time a key is pressed so you can decide if you want to display the character associated with the key or perform some other action.


Accessing the keyboard view direct is strictly undocumented, so don't think of applying it to any AppStore apps.

However, you can make an off-screen text field, and use it to capture keyboard input.

0

精彩评论

暂无评论...
验证码 换一张
取 消