Detect space and space + shift key press on iPhone Keyboard
I'm trying to find a simple example to detect certain key events on the iPhone keyboard but 开发者_C百科am having trouble finding examples. Does anyone have simple examples? I'm attempting to do a simple substitution when the Space and Space+Shift keys are pressed.
You can use the shouldChangeTextInRange:
delegate to detect characters:
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString*)string {
if([string isEqualToString:@" +"]) {
/* do something */
}
}
精彩评论