Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If I want formatted text but don't want to use UIWebView, is Core Text my only remaining option?

If I want formatted text (variations on size, position of certain text elements, etc) but don't want to use UIWebView, is Core Text my only remaining option?

I'm shying away from UIWebView primarily because of problems getting the layout right when switching between the iPad and the iPhone. Rather than doing conditional code and dynamically adjusting the HTML depending on device/orientation, I thought I would go ahead and look at using Core Text.

Suggestions?

like image 777
Chris Roberts Avatar asked Feb 12 '11 00:02

Chris Roberts


1 Answers

Perhaps NSAttributedString could help your cause?

An NSAttributedString object manages character strings and associated sets of attributes (for example, font and kerning) that apply to individual characters or ranges of characters in the string. An association of characters and their attributes is called an attributed string. The cluster’s two public classes, NSAttributedString and NSMutableAttributedString, declare the programmatic interface for read-only attributed strings and modifiable attributed strings, respectively.

like image 99
Stepan Hruda Avatar answered Nov 15 '22 05:11

Stepan Hruda