I have a custom UITableViewCell. In its function - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier, I need to know the cell height as defined in the tableView function heightForRowAtIndexPath so I can properly position UITextField, UIButton, etc in the cell. . Any ideas?
Take the 2-minute tour
×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
The way I usually go about doing this is I add a method to my NSObject subclass that will act as my datasource object (what goes into the datasource array, assuming you're using this basic approach). eg. Say we need to display a bunch of blog posts (pure text), each post is a cell. Since each row will have variable height, I create an NSObject subclass, call it BlogPostInfo. In this class, I add the method:
Since you have this method in your data object, you can use it as follows in the UITableViewController:
That's how I do dynamic heights of tableviewcells. |
|||
|