我在 Interface Builder 的 UITableView 中组成了几个不同的自定义单元格,包括每个单元格都有一个自定义高度,大于默认的 44 像素高。
然后我像这样加载它们:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier;
for (int cell = 0; cell <= [tableCellsArray count]; cell++)
{
if ([indexPath row] == cell)
{
CellIdentifier = [tableCellsArray objectAtIndex:cell];
}
}
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell...
return cell;
}
它们每个都有一个自定义类,在上面的代码中,我遍历一个数组,该数组基本上保存了相关的单元格标识符。然而,在运行应用程序时,所有单元格都返回默认的 44 像素高度。
如果不使用委托方法返回我自己的单元格高度,我是否没有遗漏可能导致这种情况的东西?
谢谢。