为什么heightForHeaderInSection和heightForFooterInSection在iOS 4.3中不起作用,它在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);
}
答案 0 :(得分:9)
来自Apple Docs
在iOS 5.0之前,对于tableView:viewForHeaderInSection:返回零视图的部分,表视图会自动将标题的高度调整为0。在iOS 5.0及更高版本中,您必须在此方法中返回每个节标题的实际高度。