I had faced same problem. If your constraints are set properly you need to set preferredMaxLayoutWidth
for each UILabel
you have in cell, just before you return the cell. Here is some example code
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
cell.lblTitle.text = @"N";
cell.lblDetails.text = @"bla bla";
cell.lblOther.text = @"other text";
// Configure the cell...
CGfloat leftPading =// "your logo width + spacing between logo and label"
CGfloat rightPading = //your label trailing space
cell.lblTitle.preferredMaxLayoutWidth = CGRectGetWidth(tableView.bounds)-(leftPading +rightPading);
cell.lblDetails.preferredMaxLayoutWidth = CGRectGetWidth(tableView.bounds)-(leftPading +rightPading);
[cell setNeedsUpdateConstraints];
[cell updateConstraintsIfNeeded];
return cell;
}
Have a look at this to know how to put constrains properly
hope this will helps you.