title: iOS: UIButton Autolayout size is zero
body: <p>Using autolayout I want to understand why the following happens: Creating a simple UIButton and setting its title. However, even though I expect the intrinsic content size of the view to be set and hence get its frame properly - the frame of the button is showing (0, 0, 0, 0). What do I have to do to get the frame value of the button ?</p>
  
  <pre><code>-(void)viewDidLoad {
  
      [super viewDidLoad];
  
      UIButton *button = [[UIButton alloc] init];
  
      [button.titleLabel setText:@"My button"];
  
      //button frame is zero
  
  }
  </code></pre>
  
  <p>Yet if I am to do that, then things work as expected:</p>
  
  <pre><code>-(void)viewDidLoad {
  
      [super viewDidLoad];
  
      UILabel *label = [[UILabel alloc] init];
  
      [label setText:@"My label"];
  
      [label sizeToFit];
  
      //label frame has the expected width and height
  
  }
  </code></pre>