sam
sam

Reputation: 3489

Format and draw text in UITableViewCell ala Twitterrific for iPhone

I would like to have formatted, clickable text and images inside a selected UITableViewCell. An example of the functionality I'm looking for can be seen in the iPhone Twitterrific app. When the user clicks on a cell, the cell is highlighted and the various links become highlighted and clickable.

I've seen the idea of using a UIWebView inside a UITableViewCell to handle formatting, but I'm unsure about this. Does that mean that every cell has to have it's own web view? I'm wondering about the expense and performance of such a method. Is there another way to get this functionality using Core Graphics?

I'm using custom drawing currently to draw my table view cells as described in atebit's blog post on fast scrolling.

Upvotes: 2

Views: 1584

Answers (2)

Hunter
Hunter

Reputation: 4371

Craig Hockenberry, author of Twitterrific, blogged about how he did that back in 2008:

http://furbo.org/2008/10/07/fancy-uilabels/

Basically, when the row is selected, he overlays UIButtons where the links are. It's imperfect, as sometimes the button won't fit in the same place the text does.

Upvotes: 2

Corey Floyd
Corey Floyd

Reputation: 25969

The first thing I would do is to checkout twitterific's old source code. And see if that version does what you are looking for.

I'm not sure how Hockenberry does it, but generally UIWebviews + UITableViewCells != fast scrolling.

My guess is that each cell does NOT contain a UIWebview until you click in it, when he quickly places a UIWebview in the cell to handle the text formatting. You then have a reusable UIWebview instance that you reuse but just change the content of repeatedly.

Upvotes: 1

Related Questions