Reputation: 411
I want to bring the keyboard up for a textfield when a viewcontroller is opened.
so I am calling becomefirstresponder on textfield and it always works.
But I wonder
Upvotes: 0
Views: 773
Reputation: 535999
There's nothing absolutely wrong with what you're doing.
Logically one might argue that viewDidLoad
is too soon, since your view (with your text field) is not in the interface; perhaps viewDidAppear
would be a more logical place. In that case, though, you have to keep in mind that viewDidAppear
can be called multiple times during the view controller's lifetime, so you'd need to distinguish whether this is the first time (not hard).
Upvotes: 1