views:

168

answers:

2

Is it possible to edit numberOfLines of UITableViewCell when click on that cell? possible?

example

cell.textLabel.numberOfLines = 1;

when selected at cell

cell.textLabel.numberOfLines = 5;

thanks for all reply

A: 

You still have the issue of the cell row height not being able to dynamically resize because it is set at the time of cell creation. (via heightForRowAtIndexPath)

Oddly enough if you want to determine the size for the text in that text label the best way to do it is with NSString's sizeWithFont.

David Sowsy
You can change the cell height "dynamically" by reloading the row.
gerry3
Not without reloading all of the rows with reloadData.
David Sowsy
A: 

I think you also need to set the frame of label

CGRect rect=cell.textLabel.frame;
rect.size.height=(5*rect.size.height);
cell.textLabel.frame=rect;

NaveenShan