title: iOS - Fit NSString into UITableViewCell
body: <p>I'm trying to fit the twitter username and tweet into a cell and am doing this by:</p>
  
  <pre><code>NSString *username = [NSString stringWithFormat:@"%@ @%@", [tweet[@"user"] objectForKey:@"name"], [tweet[@"user"] objectForKey:@"screen_name"]];
  
  
  NSString *tweet = [NSString stringWithFormat:@"%@", tweet[@"text"]];
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/xNdp5.png" alt="The entire NSString of the tweet is not fitting into the cell"></p>
  
  <p>I tried the following in <code>heightForRowAtIndexPath</code> as suggested in another question on here:</p>
  
  <pre><code>NSString *header = [NSString stringWithFormat:@"%@ @%@", [tweet[@"user"] objectForKey:@"name"], [tweet[@"user"] objectForKey:@"screen_name"]];
  
  
  NSString *tweetData = [NSString stringWithFormat:@"%@", tweet[@"text"]];
  
  CGRect head = [header boundingRectWithSize:CGSizeMake(300.f, CGFLOAT_MAX) options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading) attributes:nil context:nil];
  
  CGRect tweetData2 = [tweetData boundingRectWithSize:CGSize(300.f, CGFLOAT_MAX) options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading) attributes:nil context:nil];
  
  CGSize size = head.size;
  CGSize size2 = tweetData2.size;
  
  CGFloat n = size.height;
  CGFloat m = size2.height;
  
  NSLog(@"%f", n + m);
  
  return (n + m) &gt; 65.0 ? (m + n) : 65.0;
  </code></pre>
  
  <p>I'm just trying to show the whole tweet and resize the cell accordingly instead of having the "..." appear</p>