I'm using this method for converting a NSRange to a CGRect as it relates to a UITextView:
- (CGRect)frameOfTextRange:(NSRange)range inTextView:(UITextView *)textView
{
UITextPosition *beginning = textView.beginningOfDocument;
UITextPosition *start = [textView positionFromPosition:beginning offset:range.location];
UITextPosition *end = [textView positionFromPosition:beginning offset:range.location+range.length];
UITextRange *textRange = [textView textRangeFromPosition:start toPosition:end];
CGRect rect = [textView firstRectForRange:textRange];
return rect;
}
This question's answer has someone asking the same question as me. The above method works great for this:
this is a great text field yes it is findthistoken
Not so great like this:
this is a great one
(new line)
(new line)
findthistoken
It seems to simply ignore the fact that there are 2 new lines characters? :/
How do I make it work with new line characters?