title: Setting UITextView cursor position to end of text
body: <p>I've looked for a solution to this all morning, but have yet to find something that works.</p>
  
  <p>I have a text view that has some existing fixed text in it that I don't want the user to be able to modify. In this case, each of my text views start with "1. ", "2. ", etc. The idea being that the text they entered will be numbered for something I'm doing later.</p>
  
  <p>I don't want the user to be able to delete this text (it is essentially "permanent"). I also don't want to allow them to start adding text in the middle of this pre-text.</p>
  
  <p>To handle this, I have done:</p>
  
  <pre><code>-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text 
  {
      if (range.location &lt; 3) return NO;
  
      return YES;
  }
  </code></pre>
  
  <p>This works great, except that if the user touches anywhere in my "1. ", "2. ", etc. parts of the view, it will set the cursor there, which then prevents the user from typing text because of the range location check. What I want to do in this case is set the cursor (perhaps in textViewDidBeginEditing) to the end of the text in the view. However, regardless of what combination of selectedRange I use, I just can't get the darn cursor to move to the end. Any help would be greatly appreciated.</p>