Reputation: 5590
I'm trying to find a simple example to detect certain key events on the iPhone keyboard but 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.
Upvotes: 1
Views: 1137
Reputation: 50707
You can use the shouldChangeTextInRange:
delegate to detect characters:
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString*)string {
if([string isEqualToString:@" +"]) {
/* do something */
}
}
Upvotes: 1