adib
adib

Reputation: 8395

How high is the spacing between UITableViewCell?

Anybody know how big is the spacing between UITableViewCells in points ? That is I would like to know whether there are any screen spaces allocated between cells in an UITableView and how high are they, in each of these separator styles:

The problem I'm currently facing is that I have a variable-height cells and I need to calculate how high a group of cells may be. Currently I'm using UITableViewCellSeparatorStyleSingleLine separator style and assuming that the inter-cell spacing is 1pt high but my calculations are often off.

That is, supposed that there are three cells, each 40 pt high, my assumption is that the total height will be 40 + 1 + 40 + 1 + 40 = 122 points high.

Questions are:

Thanks in advance.

Upvotes: 2

Views: 721

Answers (1)

Nick Lockwood
Nick Lockwood

Reputation: 40995

This is a problem you can solve very easily by taking a screenshot from interface builder and then measuring it in Photoshop, however I've saved you the trouble:

The separator is not added to the the height of the table cell - it is drawn in front of the cell, so if your table cell height is 44 (the default) then the combined height of two cells will be 88, regardless of which separator style you choose.

Upvotes: 1

Related Questions