0

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?

Community
  • 1
  • 1
Nimrod
  • 5,148
  • 1
  • 23
  • 39

1 Answers1

1

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

Alex Reynolds
  • 91,635
  • 50
  • 223
  • 320
  • Thanks. I'm still not used to the whole Category pattern used in Objective-C. I understand how it works and what the point is, but I'm just so used to being able to look up the docs for `NSString` and find ALL of the supported methods. So I keep finding methods like `awakeFromNib` that are defined as NSObject methods, and I'm basically like "WTF? I thought I read the docs on NSObject already?" I wish there were a good way I could look up all of the methods for a given class like NSString defined by anything that defines a category in say Cocoa Touch or something. – Nimrod Feb 01 '10 at 05:04
  • Apple added a few category additions for `NSString` and `UITableView` to help make them easier to use on the iPhone. You can also make your own category additions, to make these and other classes more useful. Categories are a really awesome design pattern for Objective-C and I definitely recommend learning about them. That said, the one thing I have learned from my limited amount of time working with Cocoa is that the best docs are the header files themselves, as opposed to Apple's official documentation. – Alex Reynolds Feb 01 '10 at 06:35