title: How can I programmatically set the vertical alignment of a UIButton - iOS
body: <p>I know how to set the vertical alignment of a button with IB; see <a href="https://stackoverflow.com/a/7538683/377384">here</a>. But I can not do it programmatically... This is one of the things I have tried:</p>
  
  <pre><code>UIButton *button  = [[UIButton alloc] initWithFrame:CGRectMake(10, 10, 110, 130)];
  [button setTitle:@"Align" forState:UIControlStateNormal];
  button.backgroundColor = [UIColor whiteColor];
  button.titleLabel.textColor = [UIColor grayColor];
  [button setContentVerticalAlignment:UIControlContentVerticalAlignmentBottom];
  
  [self.view addSubview:button];
  
  [button release];
  </code></pre>
  
  <p>I have also tried insets...</p>
  
  <p>But the alignment won't change.</p>
  
  <p>Please note that I want to keep the CustomStyle of the button (I don't want the default look and feel).</p>