I want to get the currently typed word in a UITextView
. A way to get a completely typed word can be found here UITEXTVIEW: Get the recent word typed in uitextvi
Your range
parameter from the - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
delegate method points at the exact place you change the UITextView
string value.
The location
property of the structure points to the changing string index, that's simple. The length
not usually equals to text.length
, be careful, user may select characters from the string to replace it with another string.