开发者

iphone keyboard keydown/keyup events?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜