views:

57

answers:

2

Hi guys, I've seen similar questions here, but still can figure out why it's not working.

How to add line break (in other words add new paragraph) in multiline UIlabel?

I have a label with a lot of text,

lbl.numberOfLines = 0;
lbl.sizeToFit;

but I'm still getting something like this: "Some text here\nAnd here I want new line"

Thank you

A: 

If your string is really ok, maybe you can try adding this line as well:

lbl.lineBreakMode = UILineBreakModeWordWrap;
AngeDeLaMort
I've tried it, but it doesn't help((
Burjua
A: 

UILabel won't respect \n, You can use option-return (in Interface builder) to force where you want a line break.

You can use a UIWebView in place of the label and then you can format however you like. (And set the lineBreakMode as AngeDeLaMort says above.)

joelm