开发者

How do I create a text field or label that resizes based on how much text is in it? [duplicate]

This question already has answers here: Closed 开发者_JS百科10 years ago.

Possible Duplicate:

How do I wrap text in a UITableViewCell without a custom cell

I've seen at least one application that uses a grouped UITableView with a cell containing paragraphs of text, and the cell is taller or shorter based on the length of the text, but I don't quite get how this is done.

How does one, given a variable width font, figure out how high a UITextField or something needs to be in order to display all of the text contained in it without reducing the point size of the font?


See Apple's documentation about NSString additions for the iPhone to read about which methods to use to calculate these metrics.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜