更新时间:2022-12-10 15:32:47
请检查自定义单元格高度将与每个单元格高度的表格视图相同。
Please check the custom cell height will be the same as table view each cell height.
您可以使用以下功能调整表视图的单元格高度。
You can use following function to adjust table view's cell height.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return height;
}
您可以使用这样的代码。
You can use code like this.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
Defination *definition = [self.dataSource objectAtIndex:indexPath.row];
NSString *detailString = definition.detailString;
CGSize detailSize;
detailSize = [detailString sizeWithFont:fontSize(12.0) constrainedToSize:CGSizeMake(420, MAXFLOAT) lineBreakMode:UILineBreakModeWordWrap];
return detailSize.height + 20.0;
}