i really need some suggestion, i need to stop an uitextview jumping into last line after inserting some text programmatically, i have read some identical question in here, here, here,and here. i've try all answers in every question, but my uitextview still always jumping into last line after inserting the text, i can make the cursor back into the last position, but i cant stop it jump, and it's make me dizzy when i use my app in simulator or device. Can somebody give me another clue?
this is the code i made for this case, i implement this in textviewDidChange
delegate method :
NSString *textAdd = @"adding text";
NSRange *range = self.codeTextView.selectedRange;
[textview setScrollEnabled:NO];
textview.userInteractionEnabled = NO;
textview.text = [textview.text stringByReplacingCharactersInRange:range withString:[NSString stringWithFormat:@"%@", textAdd]];
textView.userInteractionEnabled = YES;
[textView becomeFirstResponder];
textView.selectedRange = NSMakeRange(range+[textadd length], 0);