Warrior
Warrior

Reputation: 39374

How to wrap a line in label in iphone?

I am new to iphone development .I want to wrap up the text in the label.I want to wrap up to a particular position in the label.Thanks.

Upvotes: 2

Views: 3357

Answers (2)

Noah Witherspoon
Noah Witherspoon

Reputation: 57139

 theLabel.lineBreakMode = UILineBreakModeWordWrap;
 theLabel.numberOfLines = 0;

That'll let it wrap an arbitrary number of lines. If you want to limit them, and have it truncate with a “...”, then set the numberOfLines property to that value.

Upvotes: 6

Jacek
Jacek

Reputation: 1914

Set "Line breaks" in Interface Builder ( http://drp.ly/d3K65 ) to "Word Wrap" and increase height of the UILabel.

You can do the same thing (or even more complex) in the code, see UILabel reference http://developer.apple.com/iPhone/library/documentation/UIKit/Reference/UILabel_Class/Reference/UILabel.html

Upvotes: 4

Related Questions