user141302
user141302

Reputation:

how to give "\n" character in label text?

I have coded like that, but can't get output:

label.text = @"hai\nyou";

but the output is hai you. I want: hai and then you must be in the next line.

Upvotes: 0

Views: 311

Answers (2)

ahmet emrah
ahmet emrah

Reputation: 1858

...
label.text = @"hai\nyou";
label.numberOfLines = 0;

Upvotes: 3

Frankie
Frankie

Reputation: 25165

Try to set the "# of Lines" to 0 and let me know if it works.

Or, if you are typing in the little box in IB use option-return to insert a line feed (\n).

Upvotes: 2

Related Questions