I'm trying to create cells with dynamic height, with only one label I have no problem, however, when I put two or more labels inside my cell, I cut part of the labels or in some cases it does not show it.
The height is like this:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
// Calculo
if(!self.myCell) {
self.myCell = [self.tabla dequeueReusableCellWithIdentifier:@"DynamicTableViewCell"];
}
// Config
self.myCell.label.text = [_dataSource[indexPath.row] uppercaseString];
self.myCell.label2.text = [_dataSource[indexPath.row] uppercaseString];
// Layout
[self.myCell layoutIfNeeded];
[self.myCell setNeedsLayout];
// Altura
CGFloat height = [self.myCell.contentView systemLayoutSizeFittingSize:UILayoutFittingExpandedSize].height;
return height;
}
Additionally, my labels have constrains in the Superview and a space between them. In addition, the number of lines is 0 and its mode of break (Line Break) is Word Wrap