i want to resize cell's height according to the label's height and label's height according to text...?? or is there any way i can resize the cell's height according to the text entered in uitextview?
+4
A:
There is a UITableView delegate method called heightForRowAtIndexPath that is called before you create a cell or a table.
You could use the NSIndexPath passed to it to get the text at a specific row and use the sizeWithFont method from UIStringDrawing.h to compute a CGSize for that row.
For example:
CGSize size = [text sizeWithFont: font
constrainedToSize:maximumLabelSize
lineBreakMode:UILineBreakModeWordWrap];
And finally you would return size.height.
Joshua Vera
2009-06-25 04:26:52
A:
More complete solution: http://stackoverflow.com/questions/129502/how-do-i-wrap-text-in-a-uitableviewcell-without-a-custom-cell
philfreo
2009-11-20 23:08:13