Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

amalshah71

macrumors member
Original poster
Feb 1, 2009
51
0
Hello,
I have a requirement to show text in the following format...

TextHeading : Actual Text (in different Font)(could be multiple lines)

Had a look at UITextView....it seems it would not serve the purpose...it shows entire text with same properties throughout....

What could be the other option , besides having to write a custom component for it by extending UIView class...

Thanks
amal
 

ghayenga

macrumors regular
Jun 18, 2008
190
0
Hello,
I have a requirement to show text in the following format...

TextHeading : Actual Text (in different Font)(could be multiple lines)

Had a look at UITextView....it seems it would not serve the purpose...it shows entire text with same properties throughout....

What could be the other option , besides having to write a custom component for it by extending UIView class...

Thanks
amal

Either a UIWebView displaying HTML formatted text, or draw it yourself with the drawstring methods, which is much more complicated. HTML in a webView is the usual way to go.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
You could use two UILabels. You can draw the text yourself using the methods in UIStringDrawing.h in a UIView subclass. You can use a web view.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
It's pretty lame that the iPhone supports CFMutableAttributedString but there is nothing to draw a UIString. If Core Text was public you could use that too, but it isn't. So UIWebView is really the only good alternative if you need more than the basics.

In an app I wrote we needed bold text right next to normal text. I just created two labels, sized them according to their fonts, and then placed them next to each other, everything being calculated dynamically. It's not hard, just annoying.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.