views:

665

answers:

1

I have multi-line non-HTML text (with newlines). Need to output it inside ScrollView or just UIView.

I can't output it as UITextView: can't find how to resize UITextView to the size of text and/or disable scroll in it.

Should I output text to Label? Or there's something more proper for that?

Thanks.

+1  A: 

Try using a UILabel, then set the lineBreakMode property to UILineBreakModeWordWrap, and the numberOfLines property to zero (unlimited lines).

Depending on the style of text you're using, you might try stripping out the newlines so the result looks better.

Tim Rupe
That makes text visible only within vertical size of the UILabel.If UILabel has size of one line, only one line will be visible.How do I resize UILabel to fit text?
Rod
Changing the numberOfLines to zero allows the label to expand the size (vertically). You shouldn't have to directly change the label size. Check out my response in a related topic on word-wrapping in a Table Cell:http://stackoverflow.com/questions/129502/how-do-i-wrap-text-in-a-uitableviewcell-without-a-custom-cell/905565#905565
Tim Rupe