Q:

UILabel height not changing

I am trying to change my two labels heights defined in custom cell but failed many times. Height of labels should change with length of text populated in. I have successfully implemented the cell height in heightForRowAtIndexPAthbut label height is not adjusting according to cell height. It either truncate the text or shrink the font. SetNumberOfLines to zero seems to have no effect. ContentTextView and TransView are my two uiLabels
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Customcell";

    CustomeCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier   forIndexPath:indexPath];

    NSString *text = [_detailItem objectAtIndex:[indexPath row]];
    NSString *text2 = [_detailItem2 objectAtIndex:[indexPath row]];

    CGSize maxSize = CGSizeMake(296.f, FLT_MAX);
    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:text];
    NSMutableAttributedString *attributedString2 = [[NSMutableAttributedString alloc] initWithString:text2];

    CGRect rect = [attributedString boundingRectWithSize:maxSize
                                 options:NSStringDrawingUsesLineFragmentOrigin
                                 context:nil];
    CGRect rect2 = [attributedString2 boundingRectWithSize:maxSize
                                                          options:NSStringDrawingUsesLineFragmentOrigin
                                                 context:nil];

    CGSize maximumLabelSize = CGSizeMake(500,CGFLOAT_MAX);
    CGSize requiredSize = [cell.contentTextView sizeThatFits:maximumLabelSize];
    CGSize requiredSize2 = [cell.transView sizeThatFits:maximumLabelSize];
    CGRect labelFrame = cell.contentTextView.frame;
    CGRect labelFrame2 = cell.transView.frame;
    labelFrame.size.height = requiredSize.height;
    labelFrame2.size.height=requiredSize2.height;
    cell.contentTextView.frame = labelFrame;
    cell.transView.frame=labelFrame2;
    [attributedString addAttribute:NSParagraphStyleAttributeName value:style range:NSMakeRange(0, [text length])];
    [attributedString2 addAttribute:NSParagraphStyleAttributeName value:style range:NSMakeRange(0, [text2 length])];

    [cell.contentTextView setLineBreakMode:NSLineBreakByWordWrapping];
    [cell.contentTextView setMinimumScaleFactor:FONT_SIZE];
    NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
    [style setLineSpacing:2];
    [style setAlignment:(NSTextAlignment)kCTRightTextAlignment];
    [cell.contentTextView setNumberOfLines:0];
    [ cell.transView setNumberOfLines:0];

    cell.selectionStyle = UITableViewCellSelectionStyleBlue;
    tableView.separatorColor = [UIColor colorWithRed:0.576 green:0.796 blue:0.008 alpha:1];

    cell.contentTextView.attributedText = attributedString;
    cell.transView.attributedText=attributedString2;

    return cell;

A:

I fixed it by setting constraints on story board. In my case, i had calculate the cell height but my labels height were not adjusting accordingly. I follow the following steps.
1- On story board, click on 'Pin' appeared on bottom and set constraints (click on labels turn by turn). 
2- In size inspector, change the intrinsic size of each label to "place holder".
3- Make sure to fix all warnings after you set your constraints otherwise it won't work

