title: Fit text in UILabel
body: <p>Here is my code </p>
  
  <pre><code> UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 50, 300, 50)];
      label.textAlignment = UITextAlignmentCenter;
      label.backgroundColor = [UIColor clearColor];
      label.textColor = [UIColor whiteColor];
      label.textColor.font = [UIFont fontWithName:@"Verdana" size:30];
      label.text = @"A very long string";
       etc...
  </code></pre>
  
  <p>The problems is that the font is large and can't fit in the label. It just display "A very"</p>
  
  <p>What to do so entire text to be displayed.
  I have tried </p>
  
  <pre><code>label.lineBreakMode = UILineBreakModeWordWrap;
  label.numberOfLines = 0;
  </code></pre>
  
  <p>But it doesn't work for me.
  I want to do that programmatically.</p>
  
  <p>//EDIT</p>
  
  <pre><code>CGRect frame = CGRectMake(10, 50, 300, 50);
      NSString *labelString = @"Players.";
  
      UILabel *howManyUsersLabel = [[UILabel alloc]initWithFrame:frame];
      howManyUsersLabel.textAlignment = UITextAlignmentCenter;
      howManyUsersLabel.backgroundColor = [UIColor clearColor];
      howManyUsersLabel.textColor = [UIColor whiteColor];
      howManyUsersLabel.adjustsFontSizeToFitWidth = NO;
      howManyUsersLabel.numberOfLines = 0;
  
      CGFloat fontSize = 30;
      while (fontSize &gt; 0.0)
      {
          CGSize size = [labelString sizeWithFont:[UIFont fontWithName:@"Verdana" size:fontSize] constrainedToSize:CGSizeMake(frame.size.width, 10000) lineBreakMode:UILineBreakModeWordWrap];
  
          if (size.height &lt;= frame.size.height) break;
          fontSize -= 1.0;
          NSLog(@"test");
      }
  
      howManyUsersLabel.font = [UIFont fontWithName:@"Verdana" size:fontSize];
  </code></pre>