views:

110

answers:

3

How can I get a UITableView to automatically wrap text which is longer than the width of the cell?

A: 

See the options for the lineBreakMode of the UILabel inside the UITableViewCell here.

hth
–f

flohei
+1  A: 

Set the "setNumberOfLines" property of the label to wrap the text to required number of lines. If you don't want the .... at the end of the text if it is too long then

label.lineBreakMode = UILineBreakModeWordWrap;

or if you want to show the ... after the text then don't use the above code.

All the best.

Warrior
+1  A: 

You need to dynamically determine the height of the cell, and set your label so that it autosizes itself. There's a fairly comprehensive explanation here: http://www.cimgf.com/2009/09/23/uitableviewcell-dynamic-height/

alku83