开发者

iphone keyboard keydown/keyup events?

开发者 https://www.devze.com 2023-01-17 21:43 出处:网络
I am wondering why I am not able to find any help regarding the keyboard keyup/keydown events, I actually want to detect which key is been pressed by the user via keyboard on iphone while inputt开发者

I am wondering why I am not able to find any help regarding the keyboard keyup/keydown events, I actually want to detect which key is been pressed by the user via keyboard on iphone while inputt开发者_高级运维ing the text in the UITextField.


You can use this delegate method to get the character that's being entered into a UITextField:

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;

For example:

if ([string isEqualToString:@"z"]){
    // z is being typed.
}

Just make sure you've said your UITextField's delegate to the class file where you implement this.

0

精彩评论

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