【问题标题】:UITableView cell's heightUITableView 单元格的高度
【发布时间】:2012-07-03 11:39:12
【问题描述】:

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

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

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

【问题讨论】:

标签: objective-c uitableview ios5


【解决方案1】:

您可以直接使用indexPath.section -

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

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

    }
    else
    {
        return 44.0;

    }
}

【讨论】:

    【解决方案2】:

    试试这个……

     indexPath.section
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-15
      相关资源
      最近更新 更多