How do I set the cursor position for a non-editable UITextView?

I don't have an editable UITextView. When it gains focus, the cursor position is at the beginning. How do I set the position of the cursor? (I'm using an iPhone to develop with a braille keyboard and when a non-editable UITextView gets focus, I have the text from the start, so I need to set the cursor position.)

+2


source to share


1 answer


If you want to set the cursor position at the end, use this delegate like this:

- (void)textViewDidChangeSelection:(UITextView *)textView{
textView.text =[NSString stringWithFormat:@"%@",textView.text];
}

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
return NO;
}

      



Remember the UITextView property is set to yes to display the cursor

0


source







All Articles