Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I automatically load the keyboard (iOS SDK)?

Tags:

really simple question:

I got a view that consists of two textfields. When the view loads I want the keyboard to automatically pop up and focus the first field.

How do I do that? (In code? In IB?)

Thanks a lot! wasabi

like image 656
pkluz Avatar asked Apr 22 '11 19:04

pkluz


2 Answers

In your viewDidAppear: method call [yourTextField becomeFirstResponder].

like image 132
Mark Granoff Avatar answered Oct 11 '22 05:10

Mark Granoff


[myTextField becomeFirstResponder] should do the trick.

Also make sure you implement the UITextFieldDelegate methods where you can hide the first responder.

like image 45
Devraj Avatar answered Oct 11 '22 04:10

Devraj