Hi All,
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
textField.becomeFirstResponder()
}
The view controller receives the viewWillAppear() message just before it becomes visible. That is a perfect time to make the text field active. You do this by sending it the becomeFirstResponder() message.
I was wondering if I just call textField.becomeFirstResponder() in viewDidLoad. For me it achieved the same thing.Can I ask if it is wrong? If yes why? Could you please give advice on this?
override func viewDidLoad() {
super.viewDidLoad()
textField.becomeFirstResponder()
navigationItem.largeTitleDisplayMode = .never
}
Many thanks