2012-04-06 30 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

相關問題