我知道,使用动态表观,您可以使用...设置单元格高度...TableView:Height ForrowatIndExpath:
但是,如果我使用的是静态表视图(不是动态),则使用各节,我想编程将单元格的高度设置为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。indexpath.section.row?
您可以直接使用indexpath.row
。无需写indexPath.Section.row
。
在iOS中,nsindexpath获得了额外的职责。这有点令人困惑,因为Apple有两个不同的文档。
如其他答案中所述,您得到:
获取部分索引
- 节属性
获取行或项目的索引
- 行属性
- 项目属性