What I want:
In an iPhone app, I'd like to show information in a tableView. In each cell, the text is like: John recently listen to music abcdefg.mp3. and if needed, the text can have two lines.
In the text, a.mp3 should be clickable so when the user touches the abcdefg.mp3 part, another page will be invoked. When user touches abcdefg.mp3, it will also have some effects, just like touching a button.
What I do:
I calculate the frame of the text, and I use a UIButton for abcdefg.mp3.
My Problem:
Sometimes abcdefg.mp3 may be in multiline, like:
abc is at the end of the first line
defg.mp3 is in second line.
What should I do in this case?
I've already searched about: Create tap-able "links" in the NSAttributedString of a UILabel? However I think it is not suitable here as the clickable text is all in one line in the sample.
See Question&Answers more detail:os