O'Reilly logo

The Complete Idiot's Guide® To iPad and iPhone App Development by Troy Brant

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

UITextFieldDelegate

Now, let’s see delegation in action. You will use delegation in order to dismiss the keyboard for each of the text fields. The general idea is that you assign the controller as the delegate for the text fields. This way you will be notified when the “return” key on the keyboard is tapped.
To achieve this, you must do three things:
1. Add the UITextFieldDelegate protocol to the controller class declaration in the header file.
2. Implement UITextFieldDelegate methods in the controller implementation file.
3. Set the controller as the delegate for each UITextField instance.
After completing these three steps, the text fields will notify the controller when certain events take place—when editing begins or ends and when the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required