2

我有以下代码:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath     *)indexPath {
SectionController *sectionController = [_sectionAndRowControllers objectAtIndex:indexPath.section];
return [[sectionController rowControllerForRow:indexPath.row] heightForRowInInterfaceOrientation:self.interfaceOrientation];
} 




- (CGFloat)heightForRowInInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

CGSize constraint = CGSizeMake(CELL_CONTENT_WIDTH - (CELL_CONTENT_MARGIN * 2), MAXFLOAT);

CGSize size = [[self descriptionString] sizeWithFont:_descriptionLabelFont constrainedToSize:constraint];

CGFloat height = MAX(size.height, kMinCellHeight);

return height + (CELL_CONTENT_MARGIN * 2);
} 

我遇到的问题是某些单元格有很多额外的填充。我怀疑这是因为我有“\n”字符来表示内容中的逻辑中断。我在这个问题上尝试了许多不同的方法和帖子,但我无法弄清楚为什么我有额外的空间。在某些情况下,额外的空间非常明显。

4

0 回答 0