定义一个特定表格单元格的高度 [英] Define height of one specific table cell
本文介绍了定义一个特定表格单元格的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有两个自定义单元格的tableView。我需要定义一个单元格的高度,但另一个单元格。我正在努力学习Objective-C,所以任何帮助都将不胜感激!
I have a tableView with two custom cells. I need to to define the height of one cell but leave the other alone. I am trying to learn Objective-C, so any help would be greatly appreciated!
推荐答案
在你的UITableView委托中,实现例程tableView:heightForRowAtIndexPath:并返回任何行所需的高度。类似于:
In your UITableView delegate, implement the routine tableView:heightForRowAtIndexPath: and return whatever height you want for whatever row. Something like:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if ( indexPath.row == 0 ) // 1st row
return 25.0;
else
return 35.0;
}
这篇关于定义一个特定表格单元格的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文