-3

我有一个简单的问题,无法解决。我的应用程序中有一个UITableView。有 3 个部分,每个部分有 3 行。

我想增加第一部分的第一个单元格的高度。我为此使用了委托,但它增加了第三部分第一个单元格的高度。

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{    
    if (indexPath.row == 0 && sectionValue==0)
    {         
        节值=1;
        返回 180.0;        
    }
    别的
    {
        返回 44.0;        
    }   
}
4

2 回答 2

2

您可以直接使用indexPath.section-

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 
{

    if (indexPath.row == 0 && indexPath.section==0) 
    {  
        return 180.0;

    }
    else
    {
        return 44.0;

    }
}
于 2012-07-03T11:40:44.373 回答
0

试试这个......

 indexPath.section
于 2012-07-03T11:42:54.543 回答