Is there a way to reduce the space between two sections of a UITableView? There are about 15 pixels between every single section I have. I did already try to return 0 for -tableView:heightForFooterInSection:
and -tableView:heightForHeaderInSection:
but that doesn't change anything.
Any suggestions?
You can actually set the footer/header/cell heights in Interface Builder under the size tab. By default the header/footer are set at 10.0.
UPDATE FOR iOS7: Due to ARC autorelease update, here's @Martin Stolz code edited.
(Using iOS7, Xcode v5.0)
You can also reduce the height of section footer and header from the storyboard. In the tableview -> size inspector. Go to Section Height.
By default it is set to 22 for Plain style table and 10 for grouped style table. You can configure values by increasing / decreasing the values for header and footer separately.
For me the issue was because I was using a grouped table view style (
UITableViewStyleGrouped
). When I changed it to a plain style (UITableViewStylePlain
) mytableView:heightForHeaderInSection:
method was the only thing determining the size of each section header.For me just this issue got resolved just by using the following code,
Returning 1 for the first section has solved the issue.
Use this perhaps, 0 will not work as expected