title: Label in dynamic cell height on table view not showing text properly
body: <p>I'm trying to get my table view cells to adjust their heights based on the content inside the cells.</p>
  
  <p>It seems to be working since the cells have different heights, but I'm having trouble with displaying the text properly.</p>
  
  <p>The table view and the prototype cell is created with storyboard and I have a custom cell class linked to my prototype cell. In my prototype cell I have three labels; Title label, date label and a label that has the dynamic text data. The dynamic text data labels line numbers are set to 0 and line break is set to "Word wrapping" in the storyboard's attributes inspector.</p>
  
  <p>When I run the app the cell heights are all different so I assume the height for row at index path works:</p>
  
  <pre><code>- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      // Text data
      NSDictionary *cellOutputDict = [newsDataArray objectAtIndex:indexPath.row];
      NSString *text = [NSString stringWithFormat:@"%@", [cellOutputDict objectForKey:@"text"]];
  
      NSAttributedString *attributedText = [[NSAttributedString alloc] initWithString:text attributes:nil];
  
      CGFloat width = 280;
      CGRect rect = [attributedText boundingRectWithSize:(CGSize){width, CGFLOAT_MAX}
                                                 options:NSStringDrawingUsesLineFragmentOrigin
                                                 context:nil];
      CGSize size = rect.size;
  
      return size.height + 2 * 20; // size.height plus 2 times the desired margin
  }
  </code></pre>
  
  <p>And this is my cell for row at index path:</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      static NSString *CellIdentifier = @"NewsCell";
      NewsCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
  
      // If the cell doesn't exists create it
      if (cell == nil) {
          cell = [[NewsCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
      }
  
      // Configure the cell...
  
      // Text data
      NSDictionary *cellOutputDict = [newsDataArray objectAtIndex:indexPath.row];
  
      cell.titleLabel.text = [NSString stringWithFormat:@"%@", [cellOutputDict objectForKey:@"title"]];
      cell.dateLabel.text = [NSString stringWithFormat:@"%@", [cellOutputDict objectForKey:@"date"]];
      cell.newsTextLabel.text = [NSString stringWithFormat:@"%@", [cellOutputDict objectForKey:@"text"]];
  
      return cell;
  }
  </code></pre>
  
  <p>The cell.newsTextLabel.text that prints out the dynamic text data is displayed in the cell, but only the first line.</p>
  
  <p>I've tried some examples of displaying dynamic cell heights for iOS 6.1 and they work fine but I can't get it to work on iOS 7+</p>
  
  <p>So I hope someone can help with this and help me to figure out what I'm doing wrong.</p>
  
  <p><img src="https://i.stack.imgur.com/XkseY.png" alt="enter image description here"></p>