0

Edit:

The data in the cell can contain multiple lines of text with hyperlinks in between

I was trying to embed hyperlinks in my UITableViewCell. I have tried adding UITextView as a subview of the cell.. however, it makes scrolling jerky. After profiling I found out 30% of the time was taken by setText in UITextView.

Isn't there any other way beside adding the classes from the Three20 project.

Regards, Satyam Shekhar

  • Have you considered creating a UILabel with a font (underlined and blue), and monitor the touch event on that label to open the link? – Devraj Jun 13 '11 at 08:30
  • Do you mean, I ll have to search the text for all the hyperlinks.. and have multiple labels in that view? That also implies that Ill have to style multiple labels so that they appear as one.. which I doesn't seem trivial? – Satyam Shekhar Jun 13 '11 at 08:44
  • I think your problem is in `cellForRowAtIndexPath:` method. Where else would you be calling `setText:` method? Can you add the code here. – Deepak Danduprolu Jun 13 '11 at 09:00
  • This post should still help - http://stackoverflow.com/questions/1256887/clickable-links-in-uilabel – petert Jun 13 '11 at 09:06

1 Answers1

0

The way I do hyperlinks is I create a UILabel with the hyperlink text and then create a UIButton of type UIButtonCustomType that is transparent and give it an action to open an URL.

Cyprian
  • 9,423
  • 4
  • 39
  • 73
  • So you are suggesting, I overlay those buttons on the hyperlinks. The only problem I see in this is adding and removing subviews which in itself is expensive I guess. – Satyam Shekhar Jun 13 '11 at 09:03