title: iOS - UIButton become first responder to open keyboard
body: <p>I need to open keyboard on button click for UIButton (not using/for UITextField). I have tried to create custom button by overriding variable <code>canBecomeFirstResponder</code> but it's not working.</p>
  
  <p>Is there any other way to do so?</p>
  
  <p><strong>Note:</strong> I want to set UIPIckerView as an input view of UIButton in key board frame.</p>
  
  <p>Here is my code.</p>
  
  <pre><code>class RespondingButton: UIButton {
  
  
      override var canBecomeFirstResponder: Bool {
          return true
      }
  
  
      override init(frame: CGRect) {
          super.init(frame: frame)
          commonInit()
      }
  
  
      required init?(coder aDecoder: NSCoder) {
          super.init(coder: aDecoder)
          commonInit()
      }
  
  
      private func commonInit() {
          // common init
      }
  
  
  
  }
  </code></pre>
  
  <p>In my view controller, I connected button action.</p>
  
  <pre><code>class TestViewController: UIViewController {
  
     @IBAction func testBecomeFirstResponder(button: RespondingButton){
        button.becomeFirstResponder()  // Not working.
     } 
  }
  </code></pre>