views:

48

answers:

1

I am trying to customize my UITableViewCell and am subclassing it and then overloading layoutSubviews as suggested in this thread:

http://stackoverflow.com/questions/1303695/adjusting-the-positions-of-the-labels-in-a-uitableviewcell/1303719#1303719

I can get the width of my label to change this way, but I am unable to use the following to make the labels multi-line.

self.textLabel.numberOfLines = 2;
self.textLabel.lineBreakMode = UILineBreakModeWordWrap;

It appears to wordwrap but only show the first line centered vertically no matter how tall I make my cell. Any suggestions?

A: 

Here is what I did to make this work. I consider it a workaround, though, as it really seems like it should be a 1-2 liner to be able to make the label in the UITableViewCell do multi-line.

Basically I subclassed the UITableViewCell and instead of overloading layoutSubviews I added a UILabel object and simply initialize it in the cellForRowAtIndexPath call that requests the cell. I don't use the textLabel that comes with UITableViewCell, although I do use the detailTextLabel (because I don't need to resize or alter this, yet).

Joey