我是iPhone应用程序开发的新手,我目前正在做一个示例表视图项目。如何更改行单元格的大小?
答案 0 :(得分:7)
heightForRowAtIndexPath
委托方法
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (Dynamic)
{
//calculate dynamic height and return from here;
return dynamicheight;
}
else
return fixedheight; //Return fixed height from here e.g. 40
}
答案 1 :(得分:5)
将此用于身高
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
switch (indexPath.row)
{
case 0:
return 10;
break;
case 1:
return 245;
break;
case 2:
return 60;
break;
case 3:
return 120;
break;
case 4:
return 60;
break;
case 5:
return 76;
break;
case 6:
return 60;
break;
case 7:
return 120;
break;
case 8:
return 60;
break;
case 9:
return 76;
break;
case 10:
return 60;
break;
case 11:
return 76;
break;
case 12:
return 60;
break;
case 13:
return 76;
break;
default:
return 44;
break;
}
}