Interface Builderでカスタムセルを設定した値に基づいて、セルの高さを動的に設定しようとしていました。これはうまくいかなかったので、先に進み、セルの高さを設定するために使用できる Apples ドキュメントでこのメソッドを見つけました - tableView:heightForRowAtIndexPath:
ただし、どのテーブルビューセルも高さを調整していないため、正しく使用しているかどうかはわかりません。それらはすべて同じ標準サイズのままです。これは私がここで使用しているコードです。
- (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;
}
どんな助けでも大歓迎です