Xcode 4.2 - UILabel Word Wrap

I know that people have asked this question alrdy a bunch of times on Stack, but the usual answer to changing “Lines: 0” and choosing “Line Breaks: Word Wrap” just don't fix it for me.

I am using Xcode 4.2 with a storyboard. I put the UILabel in the view controller and resized it to cover most of the view. I changed the value of "Lines" to 0 and "Line Break" on Word Wrap.

I tried \nin my line:@"This is my label text \n that supposed to wrap."

Any ideas?

EDIT: I did not declare any label properties in my implementation file, only on the storyboard, so I tried the following ... But with no luck; \ (name and font size and alignment work, but the number of lines and interrupt mode seem to do nothing .)

lblText.numberOfLines = 0;
lblText.font = [UIFont fontWithName:@"Helvetica" size:(15.0)];
lblText.lineBreakMode = UILineBreakModeWordWrap;
 lblText.textAlignment = UITextAlignmentLeft;

+5
source share
1 answer

try it

[lblText setFrame:CGRectMake(10, 21, 100, 250)];
lblText.text =@"This is my label text \n that supposed to wrap.";
lblText.numberOfLines = 3;
lblText.font = [UIFont fontWithName:@"Helvetica" size:(15.0)];
lblText.lineBreakMode = UILineBreakModeWordWrap;
lblText.textAlignment = UITextAlignmentLeft;
+10
source

All Articles