iphone - number of lines in UILabel -


I need to get the number of lines in a UILBL so that I can move the other UILB downwards. The last line I did is:

  int lines = [cellDetailTextLabel.text sizeWithFont: cellDetailTextLabel.font to constrain the size: celltiticteabel.fr.max linebrokeModa: uilinebrakemodworddrape] .ht / 16;  

But this is not perfect because in some cases when UILBL is 3 line long, the above code only gives 2, but it is not for all 3 lines of ULABLELES. It is better to treat UILBL text layout as a black box (these are fun things like auto-adjusting font size I / O>

  // Unless it fits your text, (or increment) is labeled with ASK: [CellDetailTextLabelSizeToofT]; // Get Frame CGRT R = SELDEATED TEXT LABEL.Frame; // Move the cellDetailTextLabel r.origin.y = CGRectGetMaxY (R); // Set the size of the second size size r.size = cellLabel2.frame.size; / / Finally, move the second label cellLabel2.frame = R;  

I have seen some strange behavior with text sizing on iPhone 4 (sometimes labels have an extra line too much or too much); I'm not sure this 4.1 Has been fixed in.


Comments