title: Why does changing font size in Interface Builder prevent UILabel resizing to fit content?
body: <p>I have a simple test app built with Xcode 4.5 and running on the Simulator for iOS6</p>
  
  <p>It's just a single UIViewController with a UIScrollView and in the UIScrollView a single UILabel.</p>
  
  <p>I set the NumberOfLines in the UILabel to 0 in the interface builder and made it the full width within the ScrollView - but only about 30 points in height. I also set the UIScrollView to vertical scrolling only. I set a couple of IBOutlets for the two UI components and set the file's owner as the delegate for the UIScrollView (and put  on the UIViewController header.) </p>
  
  <p>In the viewDidLoad I just set the text of the label to a nice long string.</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
      self.txtLabel2.text = @"`Twas brillig, and the slithy toves - Did gyre and gimble in the wabe: - All mimsy were the borogoves, - And the mome raths outgrabe. ";
  }
  </code></pre>
  
  <p>and then in the ViewDidAppear I set the content size of the scroll view to the size of the UILabel:</p>
  
  <pre><code>-(void)viewDidAppear:(BOOL)animated
  {
      self.scrollView.contentSize = self.txtLabel2.bounds.size;
  }
  </code></pre>
  
  <p>This seems to work well - the UILabel adjusts its height automagically and the scroll view is set to the correct height and scrolls nicely through the text. Great.</p>
  
  <p>However, I'm obviously doing something serious wrong here - because if I go into the interface builder and change the Font size of the UILabel from the default (17.0) to any other value - it stops working. The label no longer resizes and is truncated at the first line.</p>
  
  <p>I have tried manually resizing the UILabel - for example using the solution suggested here:</p>
  
  <p><a href="https://stackoverflow.com/questions/406212/sizing-a-uilabel-to-fit">Sizing a UILabel to fit?</a></p>
  
  <p>and using the extension when I set the content:</p>
  
  <pre><code>self.txtLabel2.text = @"`Twas brillig, and the slithy toves - Did gyre and gimble in the wabe: - All mimsy were the borogoves, - And the mome raths outgrabe. ";
  //use the current width - resize the height
  [self.txtLabel2 sizeToFitFixedWidth:self.txtLabel2.bounds.size.width];
  </code></pre>
  
  <p>but this doesn't seem to have any effect.</p>
  
  <p>I don't understand why changing the font size should change the behaviour of the UILabel automatically resizing and I don't know why manually setting the size of the UILabel has no effect. What is happening here? (and also - what should I do differently so that I don't get into this mess in the first place!)</p>