title: Create UITextRange from NSRange
body: <p>I need to find the pixel-frame for different ranges in a textview. I'm using the <code>- (CGRect)firstRectForRange:(UITextRange *)range;</code> to do it. However I can't find out how to actually create a <code>UITextRange</code>.</p>
  
  <p>Basically this is what I'm looking for:</p>
  
  <pre><code>- (CGRect)frameOfTextRange:(NSRange)range inTextView:(UITextView *)textView {
  
      UITextRange*range2 = [UITextRange rangeWithNSRange:range]; //DOES NOT EXIST 
      CGRect rect = [textView firstRectForRange:range2];
      return rect;
  }
  </code></pre>
  
  <p>Apple says one has to subclass <code>UITextRange</code> and <code>UITextPosition</code> in order to adopt the <code>UITextInput</code> protocol. I don't do that, but I tried anyway, following the doc's example code and passing the subclass to <code>firstRectForRange</code> which resulted in crashing.</p>
  
  <p>If there is a easier way of adding different colored <code>UILables</code> to a textview, please tell me. I have tried using UIWebView with <code>content editable</code> set to TRUE, but I'm not fond of communicating with JS, and coloring is the only thing I need.</p>
  
  <p>Thanks in advance.</p>