Why heightForHeaderInSection doesn't work in iOS 4.3?
-
29-05-2021 - |
Question
Why heightForHeaderInSection and heightForFooterInSection doesn't work in iOS 4.3 and it works in 5.0?
-(CGFloat)tableView:(UITableView*)tableView heightForHeaderInSection:(NSInteger)section
{
if (section == 0) {
return 10.0;
}
return (tableView.sectionHeaderHeight - 20);
}
-(CGFloat)tableView:(UITableView*)tableView heightForFooterInSection:(NSInteger)section
{
if (section == ([self.optionsArray count] - 1)) {
return 15.0;
}
return (tableView.sectionFooterHeight - 20);
}
Solution
From Apple Docs
Prior to iOS 5.0, table views would automatically resize the heights of headers to 0 for sections where tableView:viewForHeaderInSection: returned a nil view. In iOS 5.0 and later, you must return the actual height for each section header in this method.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow