title: AutoLayout multiline UILabel cutting off some text
body: <p>I'm trying to learn auto layout, finally thought I was getting the hang on it when this happened. I'm playing about with prototype cells and labels. I'm trying to have a </p>
  
  <ul>
  <li>Title, <code>titleLbl</code> - blue box in picture</li>
  <li>Money, <code>moneyLbl</code> - green box in picture</li>
  <li>Subtitle / Description, <code>subTitleLbl</code> - red box in picture</li>
  </ul>
  
  <p>So far I have this:</p>
  
  <p><img src="https://i.stack.imgur.com/9zuiN.png" alt="iphone screenshot"></p>
  
  <p>What I want to achieve is:</p>
  
  <ul>
  <li>The green box should always display on 1 line fully</li>
  <li>The value inside the green box should be centred based on the blue box</li>
  <li>The blue box will take the remaining space (-8px for horizontal constraint between the 2) and display on multiple lines if necessary</li>
  <li>The red box should be underneath and display as many lines as needed.</li>
  </ul>
  
  <p>As you can see this is nearly all working, with the exception of the example in the last row. I've tried to research this and from what I can gather it is something to do with the intrinsic content size. Many posts online recommend setting <code>setPreferredMaxLayoutWidth</code>, i've done this in multiple places for the <code>titleLbl</code> and it has had no effect. Only when hardcoding it to <code>180</code> did I get the results, but it also added whitespace / padding to the other blue boxes on top / underneath the text, greatly increasing the space between the red / blue boxes.</p>
  
  <p>Here are my constraints:</p>
  
  <p>Title:
  <img src="https://i.stack.imgur.com/7N5ES.png" alt="title constraints"></p>
  
  <p>Money:
  <img src="https://i.stack.imgur.com/TeLVl.png" alt="money constraints"></p>
  
  <p>Subtitle:
  <img src="https://i.stack.imgur.com/BtK3y.png" alt="subtitle constraints"></p>
  
  <p>Based on tests i've run with other text samples it does appear to be using the width as shown in the storyboard, but any attempt to correct it isn't working.</p>
  
  <p>I have created an ivar of the cell and used it to create the height of the cell:</p>
  
  <pre><code>- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      [sizingCellTitleSubMoney.titleLbl setText:[[tableViewData objectAtIndex:indexPath.row] objectForKey:@"title"]];
      [sizingCellTitleSubMoney.subtitleLbl setText:[[tableViewData objectAtIndex:indexPath.row] objectForKey:@"subtitle"]];
      [sizingCellTitleSubMoney.moneyLbl setText:[[tableViewData objectAtIndex:indexPath.row] objectForKey:@"cost"]];
  
      [sizingCellTitleSubMoney layoutIfNeeded];
  
      CGSize size = [sizingCellTitleSubMoney.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
      return size.height+1;
  }
  
  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      MATitleSubtitleMoneyTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifierTitleSubTitleMoney];
  
      if(!cell)
      {
          cell = [[MATitleSubtitleMoneyTableViewCell alloc] init];
      }
  
  
      cell.titleLbl.layer.borderColor = [UIColor blueColor].CGColor;
      cell.titleLbl.layer.borderWidth = 1;
  
      cell.subtitleLbl.layer.borderColor = [UIColor redColor].CGColor;
      cell.subtitleLbl.layer.borderWidth = 1;
  
      cell.moneyLbl.layer.borderColor = [UIColor greenColor].CGColor;
      cell.moneyLbl.layer.borderWidth = 1;
  
  
      [cell.titleLbl setText:[[tableViewData objectAtIndex:indexPath.row] objectForKey:@"title"]];
      [cell.subtitleLbl setText:[[tableViewData objectAtIndex:indexPath.row] objectForKey:@"subtitle"]];
      [cell.moneyLbl setText:[[tableViewData objectAtIndex:indexPath.row] objectForKey:@"cost"]];
  
      return cell;
  }
  </code></pre>
  
  <p>I've tried setting <code>setPreferredMaxLayoutWidth</code> inside the cell's layout subviews:</p>
  
  <pre><code>- (void)layoutSubviews
  {
      [super layoutSubviews];
  
      NSLog(@"Money lbl: %@", NSStringFromCGRect(self.moneyLbl.frame));
      NSLog(@"prefferredMaxSize: %f \n\n", self.moneyLbl.frame.origin.x-8);
  
      [self.titleLbl setPreferredMaxLayoutWidth: self.moneyLbl.frame.origin.x-8];
  }
  </code></pre>
  
  <p>log:</p>
  
  <pre><code>2014-04-30 21:37:32.475 AutoLayoutTestBed[652:60b] Money lbl: {{209, 20}, {91, 61}}
  2014-04-30 21:37:32.475 AutoLayoutTestBed[652:60b] prefferredMaxSize: 201.000000 
  </code></pre>
  
  <p>Which is what I would expect as there is 8px between the 2 elements and the console verifies this. It works perfectly on the first row no matter how much text I add to the blue box, which is the same as the storyboard, but any increase to the green box throws off the width calculation. I've tried setting this in the <code>tableView:willDisplayCell</code> and the <code>tableView:heightForRowAtIndexPath:</code> as well based on answers from other questions. But no matter what it just doesn't layout.</p>
  
  <p>Any help, ideas or comments would be greatly appreciated</p>