Cell height


I’ve had some issues where the image displayed in the cell runs over the bottom line and spills into the next cell. It seems that the cell height is fixed at 42 pts. Like this everything fits if you keep the UIImageView at 40x40 and vertically centered. I tried other sizes and locations trying to get a larger border around the image, but it seems like nothing I do to the cell xib makes the row any taller. Am I missing something? I thought that the xib would calculate a height of the enclosed views and report it back, or that you could at least set the height in the xib and have it use that, but it does not seem to be the case.


As an update - what I’ve found so far.

You can set a global height for rows, but not in the TableViewCell in the xib. The setting is in the tableView itself (which is an instance in ItemsViewController). So you can set it using something like this in ItemsViewController.m in (say) -init.

[[self tableView] setRowHeight:60.0];

There is also a method in the delegate called -tableView:heightForRowAtIndexPath: where you can set a height on a given row. There are warning about this method and performance implications, as it is called on every row when the table is shown. If you have many rows (more than several hundred?) then this can be an issue.