我正在根据您在Interface Builder中设置自定义单元格的值动态设置我的单元格高度。这没有发挥出来,所以我不停地向前,发现苹果的文档这种方法可用于设置单元格的高度 - 的tableView:heightForRowAtIndexPath:为自定义单元格设置uitableviewcell高度
但是我不知道如果我正确地使用它作为无我的tableviewcells正在调整他们的高度,他们都保持相同的标准尺寸。这是我在这里使用的代码。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Set cell height
[self tableView:tableView heightForRowAtIndexPath:indexPath];
// Configure the cell using custom cell
[[NSBundle mainBundle] loadNibNamed:@"CustomcellA" owner:self options:nil];
cell = customcellA; // customcellA getters and setters are set up in .h
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 44;
}
任何帮助,将不胜感激
为什么downvote? – GeneralMike