What are the default cell, section header, and section footer dimensions (width, height, left/right margin, top/bottom margin) for a UITableView in the grouped style?
I already know:
- Cell height: 44px, same as always
- Section header height: 22px (from this answer) –
myTableView.sectionHeaderHeightreturns 10, but I can tell that’s not right by looking at it when I set section titles.
My reason for asking is that I need to compute the expected total height of a grouped-style UITableView for returning from contentSizeForViewInPopover. But if I’m asking for the heights, I might as well ask for the widths for future reference.
doesn’t storyboard tell you the section header’s and footer’s height? It does tell me based on the screenshot below:
Fig 1: Section header and footer height when Cell set to GROUPED
Fig 2: Section header and footer height when Cell set to PLAIN
The section width depends on your application coding. If you are using the
UITableViewController, then the width would be the screen size (depending on iPhone/iPad). If you are having aUITableViewwithin aUIView, then your width would be as you sized it.Also, the cell height (
44) you mentioned is it’s default settings. If you are using custom cell, then each cell height could change.With regard to the cell width, some guy measured it and posted it on his blog. However, if you want to have custom width, then this post on SO will be helpful: How to set the width of a cell in a UITableView in grouped style