Search code examples
iostextuitextviewhighlight

Highlighted text in iOS (karaoke like app)


I am trying to create a karaoke-like application but I'm facing a problem.

I have a song as an mp3 and the corresponding lyrics shown in a UITextView. I want to highlight/underline (or something like this) the words that are heard from that mp3 file. I have the corresponding timing for each word (startTime, endTime, duration) but I have no idea how to get them highlighted.

I've searched on Stack Overflow but none of the already posted questions solved my problem.

I've seen that UITextView could be inappropriate for my requirement, but I have no idea what else to use.

I've seen something like this presented at WWDC 2011: a Core Animation "Bouncing Ball" demo, but I couldn't manage to implement it.

Please help me find a way to do this.


Solution

  • I found that the easiest way to do this would be using a uiwebview, insert the text in html format and underline/highlight it using javascript...hope it helps to everyone who want to do this :)