views:

134

answers:

3

Hi, everyone...

I need to know how to add a linebreak in plain text such as UILabel.

Soli...there is an amendment at here....

The linebreaks will added on the plain text on SMS or any notification alert message.

So, the "escape sequence" can used as well ?

Thanks

A: 

I haven't tried this, and I'm not sure if it'll display properly, but have you tried putting \n in your NSString?

myLabel.text = @"First Line\nSecond Line";
Thomas Müller
+1  A: 

The escape sequence "\n" adds a newline.

@"Line one\nLine two" will display as

Line one
Line two
Gordon Wilson
thanks 4 the solution
elson
+3  A: 

set the property numberOfLines of the label to 0. Then,

yourlabel.text = @"Line 1\nLine2";

will display as:

Line 1
Line 2
Marco Mustapic
thanks for the solution
elson