title: Text to speech: highlighting word by word for iphone
body: <p>I am doing text to speech on a <code>UITextView</code> by using flite-1.4-iphone. While reading the text, I want to automatically highlight the text word by word.</p>
  
  <ol>
  <li>How can I synchronize the voice to the text highlighting while reading?</li>
  <li>How can I highlight the text on the text view?</li>
  </ol>
  
  <p>Here's my current code:</p>
  
  <pre><code>-(IBAction)btnClick:(id)sender
  {
      [indicator startAnimating]; 
      textToSpeech = [[TextToSpeech alloc] init]; 
      [textToSpeech setVoice:@"cmu_us_awb"];
      [textToSpeech speakText:txtview.text];
      if ([txtview.text isEqualToString:@""]) 
      {
          [textToSpeech stopTalking];
          [self animate];
      }
  }
  </code></pre>