You can add this in cell subclass and get the true height:
-(void)layoutSubviews {
[super layoutSubviews];
// Get frame: self.contentView.frame
}
And load nib cell. First, register nib:
[self.tableView registerNib:[UINib nibWithNibName:@"CustomCellNibName" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"CustomCellReuseIdentifier"];
Load nib in tableView:cellForRowAtIndexPath
:
id cell = [self dequeueReusableCellWithIdentifier:@"CustomCellReuseIdentifier"];
if (cell == nil) {
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomCellNibName" owner:self options:nil];
for (id currentObject in topLevelObjects){
if ([currentObject isKindOfClass:[CustomCell class]]){
cell = currentObject;
break;
}
}
}
Believe you can convert it to Swift.
When is layoutSubviews called?