[ACCEPTED]-How to open the keyboard automatically on UITextField?-builder

Accepted answer
Score: 139

To cause the keyboard to show up immediately 3 you'll need to set the text field as the 2 first responder using the following line:

[textField becomeFirstResponder];

You 1 may want to place this in the viewDidAppear: method.

Score: 13

Swift 3 & 4:

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    textField.becomeFirstResponder()
}

0

Score: 1
override func viewDidLoad() {
    super.viewDidLoad()
    textField.becomeFirstResponder()
}

0

Score: 0

Prefer adding the first responder on the 2 main thread -

 override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    DispatchQueue.main.async {
        self.textField.becomeFirstResponder()
    }
}

This will come in handy when 1 view controller view is added as a subview.

More Related questions