I have a UITextField
that I want to set into editing mode (keyboard on screen and cursor in text field box) programatically. I know that the user will be in editin
You have to call [textField becomeFirstResponder]
;
Call becomeFirstResponder
on the UITextField.
Related question: How do I show the keyboard by default in UITextView?
Indeed call [textField becomeFirstResponder]
in Obj-C or textField.becomeFirstResponder()
in Swift.
However, make sure you call this in the viewDidAppear
and not in the viewDidLoad
to prevent strange behaviour (see: When set UITextField as FirstResponder programmatically, cause some weird actions on text editing).