Reputation: 9090
I want to show the keyboard just after a view controller is being pushed to start editing a specific UITextField.
I believe that I should manually fire the event on the ViewDidAppear.
Which is the proper way of doing such tasks?
Upvotes: 2
Views: 101
Reputation: 19418
for that you need IBOutlet UITextFiled *yourTextField;
- (void)viewDidLoad or viewWillAppear:(BOOL)animated or viewDidAppear:(BOOL)animated
{
[yourTextField becomeFirstResponder];
}
Upvotes: 1
Reputation: 170829
To make keyboard appear you need to manually set your text field as a first responder:
[textField becomeFirstResponder];
It can be called either in viewWillAppear:
or in viewDidAppear:
method - whichever provides best behaviour for you.
Upvotes: 3