UITableViewAutomaticDimension
I have a table view that has dynamic cells generated by code. In IOS 7
to make sure the cell is fully displayed, I override the methodheightForRowAtIndexPath
overriding this method in ios8 seems to force my cells to just be one on top of the other and everything is 67.0003
I do not want to create an auto audit mockup for cells, they are too complex and already done
Is there a way to fix the height issue in ios 8?
source to share
If you want dynamic cell height you need to set cell size first
For example: you want to provide some text information in each table cell, first you need to calculate the cell height according to it and then set the cell height to heightForRowAtIndexPath
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath: (NSIndexPath *)indexPath
{
NSString* text= [yourArray objectAtIndex:indexPath.row];
CGSize textSize= [text getTextSize];
if (textSize<SomeMinValue)
{
textSize= CGSizeMake(cellWidth, SomeMinValue)
}
return textSize.height;
}
source to share