UITextView cumple con UITextInput, cuya descripción detallada se puede encontrar here.
Eche un vistazo a los métodos necesarios "textRangeFromPosition: toPosition:", "positionFromPosition: offset:", "positionFromPosition: inDirection: offset:", y algunos de los otros métodos basados en geometría en el protocolo UITextInput. Esos podrían proporcionar la funcionalidad que está buscando.
No he intentado realmente asegurarme de que estos funcionen como usted los quiere, pero parece que se trata de lo que necesita.
¡Avíseme si necesita más ayuda!
ACTUALIZACIÓN:
Aquí hay un código de ejemplo de cómo hacer esto. Terminé obteniendo el método "firstRectForRange:" para que funcione. Este código básicamente toma las últimas tres letras de UITextView "textStuff" y lo resalta en verde.
UITextView *textStuff = [[UITextView alloc] init];
textStuff.frame = CGRectMake(2.0, 200.0, 200.0, 40.0);
textStuff.text = @"how are you today?";
textStuff.textColor = [UIColor blackColor];
UITextPosition *Pos2 = [textStuff positionFromPosition: textStuff.endOfDocument offset: nil];
UITextPosition *Pos1 = [textStuff positionFromPosition: textStuff.endOfDocument offset: -3];
UITextRange *range = [textStuff textRangeFromPosition:Pos1 toPosition:Pos2];
CGRect result1 = [textStuff firstRectForRange:(UITextRange *)range ];
NSLog(@"%f, %f", result1.origin.x, result1.origin.y);
UIView *view1 = [[UIView alloc] initWithFrame:result1];
view1.backgroundColor = [UIColor colorWithRed:0.2f green:0.5f blue:0.2f alpha:0.4f];
[textStuff addSubview:view1];
resultado de ejecutar este código:
He aquí cómo. https://discussions.apple.com/thread/2511930?start=0&tstart=0 –