Dynamically change cell height
1. Use the return value of the tableview proxy method to determine the cell height of each row
-(Cgfloat) tableview :( uitableview *) tableview heightforrowatindexpath :( nsindexpath *) indexpath
2. uifont
// Returns the Row Height of the font.
* [Uifont systemfontofsize: 10]. lineheight
3. Example of dynamically changing cell height
# Pragma mark-return the cell height of each row-(cgfloat) tableview :( uitableview *) tableview heightforrowatindexpath :( nsindexpath *) indexpath {// 1. retrieve the content of this line of Weibo status * s = _ statuses [indexpath. row]; // 2. calculate the height occupied by Weibo content. nsstring * text = S. text; cgfloat textheight = [text sizewithfont: [uifont systemfontofsize: 15] constrainedtosize: cgsizemake (250, maxfloat) linebreakmode: nslinebreakbywordwrapping]. height; // sizewithfont: Based on words Body to calculate the width and height of the text. // constrainedtosize: the width and height of the calculated text set. The maximum width is 250 pixels. // linebreakmode: line feed mode. // 3. calculate the height of the nickname cgfloat screennameheight = [uifont systemfontofsize: 13]. lineheight; // 4. cell height: height of Weibo content + height of Weibo nickname + height of cgfloat cellheight = screennameheight + textheight + 35; // set the height of Cell Return cellheight <75? 75: cellheight ;}