I've run into a problem where iOS is giving my UITextViewDelegate incorrect information when the delete key is held on the keyboard.
When the user HOLDS the delete key on a UITextView on an iPad the UITextView will begin to delete entire words instead of individual characters the longer it is held down (note: this does not occur in the simulator).
When this happens, the UITextView delegate method:
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
Gets called with a range consisting of the correct cursor location, but a length of 1. This is incorrect as the UITextView is now deleting entire words, not single letters. The following code, for example, will print only a single space.
[textView substringWithRange:range]
string contains " "
Despite the UITextView removing a whole word. The replacement text is correctly given as the empty string. Does any one know of a solution or workaround to this problem?