leolobato
leolobato

Reputation: 2379

Formatting multi-line text on the iPhone

I need to display some text on multiple views loaded on a UIScrollView. It should be centered both vertically and horizontally.

I did accomplish this with no problems using a UITextView, but now I need to perform a little bit of formatting in the middle of the text - some color changing and italics.

My first try was to use a UIWebView for that, declare some CSS for the <i> tag with the right color and it did work, but it's just too slow. Sometimes the view gets scrolled on the screen and takes a good second before it's text is updated.

I've thought Core Graphics, but some docs reading and google showed me this is a tough task. I mean, if it's the only option, I'll have to learn it. But before that, I'd like to know if there is anything else I should try.

So, could you guys point me in the right direction? Is there any other option or what do I need to search for drawing multi-line, centered, formatted text in Core Graphics?

Upvotes: 1

Views: 1194

Answers (1)

coneybeare
coneybeare

Reputation: 33101

You can use a custom UILabel. Joe Hewitt (Facebook app developer) uses one and has open sourced much of his code. It is called Three20

I think what you want is the TTStyledTextLabel

Upvotes: 1

Related Questions