如何设置默认的UITableViewCell高度?
我对UITableViewCells使用可变高度。不过,这种方法正常工作 我发现,不管最后一个细胞的高度是什么,它都会变成它下面所有空白细胞的高度。如何设置默认的UITableViewCell高度?,uitableview,Uitableview,我对UITableViewCells使用可变高度。不过,这种方法正常工作 我发现,不管最后一个细胞的高度是什么,它都会变成它下面所有空白细胞的高度。 是否有一种方法设置出现在最后一个单元格之下的空白单元格的默认高度? 谢谢。如果您使用的是switch语句,请在默认情况下设置空单元格的默认高度。像这样 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
是否有一种方法设置出现在最后一个单元格之下的空白单元格的默认高度?
谢谢。如果您使用的是switch语句,请在默认情况下设置空单元格的默认高度。像这样
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
int rowHeight = 40;
switch (indexPath.row) {
case 0:
rowHeight = 80;
break;
case 1:
rowHeight = 300;
break;
default:
rowHeight = <your default value>;
break;
}
return rowHeight;
}
-(CGFloat)tableView:(UITableView*)tableView rowatinexpath的高度:(nsindepath*)indepath{
整数行高=40;
开关(indexPath.row){
案例0:
行高=80;
打破
案例1:
行高=300;
打破
违约:
行高=;
打破
}
返回高度;
}
如果使用switch语句,则在默认情况下设置空单元格的默认高度。像这样
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
int rowHeight = 40;
switch (indexPath.row) {
case 0:
rowHeight = 80;
break;
case 1:
rowHeight = 300;
break;
default:
rowHeight = <your default value>;
break;
}
return rowHeight;
}
-(CGFloat)tableView:(UITableView*)tableView rowatinexpath的高度:(nsindepath*)indepath{
整数行高=40;
开关(indexPath.row){
案例0:
行高=80;
打破
案例1:
行高=300;
打破
违约:
行高=;
打破
}
返回高度;
}
请参见,这可能会有所帮助。不要错过对已接受答案的评论。看,这可能会有所帮助。不要错过对已接受答案的评论。