2

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?

Odys
  • 8,951
  • 10
  • 69
  • 111

2 Answers2

3

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.

Vladimir
  • 170,431
  • 36
  • 387
  • 313
1

for that you need IBOutlet UITextFiled *yourTextField;

- (void)viewDidLoad or viewWillAppear:(BOOL)animated or viewDidAppear:(BOOL)animated
{
  [yourTextField becomeFirstResponder];
}
Maulik
  • 19,348
  • 14
  • 82
  • 137