I try to set up a tableView. I use standard cells for all sections’ rows except in the last section (containing one row). Thus, I would also like to use the standard layout for all those sections except that special one.
A short example is the following, my “special” cell is in section 3 (there is only one row):
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
if (section == 3)
return 5;
return **????**;
}
At ??? I would like to return the width calculated from UITableView (just as if I did not implement the method).
[super self:tableView
heightForHeaderInSection:(NSInteger)section];
does not work. I know I can access
[tableView setionHeaderHeight]
which is by default 10 and obviously does not take into account that I have section headings for the other sections, which will require additional space. I tried that, but it will then get the sections too close (see screenshot):
(Note: the section I am interested in is the one which does not look like a cell: the one with the dates (invisible background)).

So, the easiest thing would be to hand over the layout to the standard implementation which is perfect – except for section3.
What are my options?
You do not have a super implementation
tableView:heightForHeaderInSection:since you are not subclassing any abstract base implementation forUITableViewDelegate. The table view is instead decided if the default height should be used by inspecting your delegate implementation to see if the method is available.It is a quite a huge concept to wrap your head around, especially if coming from Java or C#. Methods in Objective-C protocols can be optional, and their absence means use default.
Your method should probably be implemented as:
The default height for grouped and plain tableviews are different (22points for plain). The default values are not exposed by
UITableView, not even as private methods. File bug at http://bugreport.apple.com to make this a public constant.