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.
精彩评论