title: Custom UILabel width based on text length programatically
body: <p>I would like to create a <code>UILabel</code> that is a little bit wider than the width of the text in the same <code>UILabel</code>. I checked a lot of questions and tried the answers from them, but still can't find the right way. I can get the width of the text, but can't redrawn the frame. </p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object {
  
  static NSString *Cell = @"cell";
  LikeActivityTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:Cell];
  
  cell.lbl.backgroundColor = [UIColor colorWithRed:7.0 green:4.0 blue:55.0 alpha:0.7];
  
  NSString *lblString = [NSString stringWithFormat:@"%@", object[@"content"]];
  cell.lbl.text = lblString;
  
  float widthIs =  [cell.lbl.text
           boundingRectWithSize:cell.lbl.frame.size
           options:NSStringDrawingUsesLineFragmentOrigin
           attributes:@{ NSFontAttributeName:cell.lbl.font }
           context:nil]
          .size.width;
  
  
      float heightIs =
          [cell.lbl.text
           boundingRectWithSize:cell.lbl.frame.size
           options:NSStringDrawingUsesLineFragmentOrigin
           attributes:@{ NSFontAttributeName:cell.lbl.font }
           context:nil]
          .size.height;
  NSLog(@"CELL TEXT WIDTH %f", widthIs);
  
  int x = widthIs + 10;
  int y = heightIs;
  // ATTEMPT 1   
  [cell.lbl setFrame:CGRectMake(0,0,x,cell.lbl.frame.origin.y)];
  
  // ATTEMPT 2
  cell.lbl.frame = CGRectMake(0, 0, x, cell.lbl.frame.origin.y);
  
  return cell;
  
  }
  </code></pre>
  
  <p>When I run these lines nothing happens, the label doesn't change that I can't understand because it should. </p>