Iphone 如何在分组样式表中设置单元格高度?
我使用interface builder制作了一个包含两种自定义单元格的表格: 除了较低单元的高度和其上单元的高度相同外,其他一切都正常。它有我放的所有东西-UIImageView等等Iphone 如何在分组样式表中设置单元格高度?,iphone,uitableview,Iphone,Uitableview,我使用interface builder制作了一个包含两种自定义单元格的表格: 除了较低单元的高度和其上单元的高度相同外,其他一切都正常。它有我放的所有东西-UIImageView等等 所以我在想,当表格样式分组时,是否无法更改单元格高度?我们可以使用UITableview委托方法: - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ if (i
所以我在想,当表格样式分组时,是否无法更改单元格高度?我们可以使用UITableview委托方法:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row == 1) {
return 100;
}
return 44;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == 1)
{
return 60;
}
else
{
return 44;
}
}
我们可以使用UITableview委托方法:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == 1)
{
return 60;
}
else
{
return 44;
}
}
你必须用这个
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
返回75.0f
}
它对我来说是完全可用的。你必须使用这个
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
返回75.0f
}
我的第二个单元格需要特定的高度,因此它的indexath.row==1;-),“else”不是必需的,因为如果indexPath.row==1为true,则无论如何都要返回。他的第二个单元格需要特定的高度,因此其indexPath.row==1;-),“else”不是必需的,因为如果indexath.row==1为true,则无论如何都要返回。如果我能帮上忙的话,我会尽量避开其他人。干净漂亮。如果我能帮上忙,我会尽量避开别人。