tags:

views:

106

answers:

1

Hi,

I display texts in a cell of the UITableView control. Now the texts that I display can be large enough to fit inside one cell width, so it displays the texts on the second line. But it breaks the word in the middle, (like if say "That sounds great, I will pick you up from the abc station", it will display "That sounds great, I will pick you up from the abc sta" on the first line and "tion" on the second line. However, I wanted to be like "That sounds great, I will pick you up from the abc" on the first line and "station" on the second line).

Could you let me know how can I do that?

Thanks.

+1  A: 

I think you can achieve this by setting the lineBreakMode on the UILabel.

// setup cell 3.0 SDK code
cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
cell.textLabel.text = @"this is some really long string....";
Jab
Thanks for your reply, I am using this, however the cell text does not wrap and the cell width is not adjusted automatically. Is there any way that the cell width will be adjusted accordingly the length of texts?
ebaccount
Sorry, I meant, "the cell height is not adjusted automatically (but I typed cell width).
ebaccount