2012-04-06 60 views
0

为什么heightForHeaderInSection和heightForFooterInSection在iOS 4.3中不起作用,它在5.0中起作用?为什么heightForHeaderInSection在iOS 4.3中不起作用?

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

回答

9

从苹果文档

此前的iOS 5.0,表视图会自动调整大小头的高度为0,其中的tableView部分:viewForHeaderInSection:返回零视图。在iOS 5.0和更高版本中,您必须在此方法中返回每个节标题的实际高度。

+0

+1完美正确,重点突出。 – Till 2012-04-06 20:43:20

相关问题