0

我知道使用动态 TableView,您可以使用... tableView:heightForRowAtIndexPath 设置单元格高度:

但是,如果我使用的是静态表格视图(不是动态的),带有部分,我想以编程方式将单元格的高度设置为 0。

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

//used to set the height of a cell

CGFloat result;
switch(indexPath.section) {

    case 0:
    {
        //How do I get the ROW number in this section?
        result = 44;
        break;
    }

    case 1:
    {
        //this works if I want to set all of the rowels to this height.
        result = 250;
        break;
    }

}

问题以另一种方式提出,如果我有 indexPath.section... 我该怎么做... indexPath.Section.row?

4

2 回答 2

1

你可以indexpath.row直接使用。不用写了indexPath.Section.row

于 2012-10-31T23:10:01.473 回答
0

在 iOS 中,NSIndexPath获得了额外的职责。这有点令人困惑,因为 Apple 有两个不同的文档。

如其他答案所述,您将获得:

获取部分索引

  • 截面属性

获取行或项目的索引

  • 属性
  • 物品属性
于 2013-01-14T01:22:21.713 回答