I get an exception for substringWithRange: the range below the method.
I have a text box with editing disabled.
I use the text box to select text only. when I select text for the first time without exception, but when I click on it a second time.
Exception: "NSRangeException", reason: "* - [NSCFString substringWithRange:]: range or index out of bounds."
- (void)textViewDidChangeSelection:(UITextView *)textView {
NSRange range = [tv selectedRange];
str = [tv.text substringWithRange:range];
}
source
share