title: iOS 9 UIButton Initialization
body: <p>I am trying to initialize a <code>UIButton</code> programmatically but see one of these errors:</p>
  
  <blockquote>
    <p>buttonWithType is unavailable: use object construction UIButton(type:)</p>
  </blockquote>
  
  <p>or </p>
  
  <blockquote>
    <p>error: incorrect argument label in call (have 'buttonWithType:', expected 'type:')</p>
  </blockquote>
  
  <pre><code>  for char in keys {
          let btn: UIButton = UIButton.buttonWithType(UIButtonType.System) as UIButton
  
          btn.frame = CGRectMake(0, 0, 20, 20)
          btn.setTitle(char, forState: .Normal)
          btn.sizeToFit()
          btn.titleLabel?.font = UIFont.systemFontOfSize(20)
  
          btn.backgroundColor = UIColor(hue: (216/360.0), saturation: 0.1, brightness: 0.81, alpha: 1)//
          btn.setTitleColor(UIColor(white: 1.0, alpha: 1.0), forState: .Normal)
  
          btn.setContentHuggingPriority(1000, forAxis: .Horizontal)
          btn.setContentCompressionResistancePriority(1000, forAxis: .Horizontal)
  
          btn.addTarget(self, action: Selector("handleBtnPress:"), forControlEvents: .TouchUpInside)
  
          self.addSubview(btn)
      }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/AetEA.png" alt="error"></p>