uitableview autolayout余分な高さを引き起こすカスタムセル。別のプロジェクトで問題が発生した場所を検出できませんでした。 uitableview autolayout余分な高さを引き起こすカスタムセル
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
[_stubCell layoutSubviews];
[self configureCell:_stubCell atIndexPath:indexPath];
CGFloat height = [_stubCell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
return height;
}
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 40.f;
}
- (void)configureCell:(CCACustomCell *)cell atIndexPath:(NSIndexPath *)indexPath {
cell.customLabel.text = [_tableData objectAtIndex:indexPath.row];
cell.customLabel.font = [UIFont fontWithName:@"Avenir-Light" size:16.0];
cell.customLabel.textColor = UIColorFromRGB(0x32383B);
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
CCACustomCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
[self configureCell:cell atIndexPath:indexPath];
return cell;
}
UILabelのテキスト文字列に、開始時に "\ n"の次の文字が含まれている場合は、それを確認してください。 –
友人がいない、 "\ n"次の行の文字はありません – santanu
@サンタヌン、これらはダイナミックセルかスタティックセルですか? –