keep on you
keep on you

Reputation: 310

Why heightForHeaderInSection doesn't work in iOS 4.3?

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);
  }

Upvotes: 0

Views: 1179

Answers (1)

Otium
Otium

Reputation: 1098

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.

Upvotes: 9

Related Questions