I have an application in which I am loading a UITableView
from 3 types custom cells
. I made 3 custom classes for that and added all the elements Progra
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;
}