Ios 表格视图,静态单元格,更改单元格高度
我知道使用动态表格视图,您可以使用。。。 tableView:RowAtIndexPath的高度: 但是,如果我使用静态表视图(非动态)和节,我希望通过编程将单元格的高度设置为0Ios 表格视图,静态单元格,更改单元格高度,ios,uitableview,heightforrowatindexpath,Ios,Uitableview,Heightforrowatindexpath,我知道使用动态表格视图,您可以使用。。。 tableView:RowAtIndexPath的高度: 但是,如果我使用静态表视图(非动态)和节,我希望通过编程将单元格的高度设置为0 -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ //used to set the height of a cell CGFloat result; switch(index
-(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;
}
}
这个问题问了另一个问题,如果我有indexath.section。。。我怎么能做像。。。
indexPath.Section.row?您可以直接使用
indexPath.row
。无需在iOS中编写indexath.Section.row
,即可获得。这有点令人困惑,因为苹果有两份不同的文档
如其他答案所述,您可以得到:
获取节索引
- 截面属性
- 行属性
- 项目属性