views:

37

answers:

1

Hi all,

What i Need to do for our project is to Display several UIScrollViews in a View and weithin the scrollView a Headline and a Short Text.

I Know how to add a Label to the UIscrollview, but how Gould i handle the Case that the Headline-Label is too Long and wraps to a Second Line.

+3  A: 

You can determine the space needed for the headline text by calling -[NSString sizeWithFont:] or one of its variants. Then size and position the labels dynamically in your code (and set their numberOfLines property to 0).

Alternatives:

  • Use a UIWebView to display formatted text (HTML).
  • Use Core Graphics to draw the text directly into the view (e.g. [NSString drawAtPoint:withFont:]).
  • Use Core Text to format and draw the text (quite complicated).
Ole Begemann
This post covers my thoughts and then some.
Moshe