Using a CALayer to highlight text in a UITextView which spans multiple lines
问题 This is a continuation of Getting CGRect for text in a UITextView for the purpose of highlighting with a CALayer. I'm having trouble with getting the correct rectangle for the ranges in each line fragment. NSString* searchString = @"Returns the range of characters that generated"; NSRange match = [[[self textView]text]rangeOfString:searchString]; NSRange matchingGlyphRange = [manager glyphRangeForCharacterRange:match actualCharacterRange:NULL]; [manager enumerateLineFragmentsForGlyphRange