Datasheet

762
Entering and Saving the Hotel Information
Listing 1-9: Implementing textFieldShouldReturn:
-(BOOL)textFieldShouldReturn:(UITextField *)
theTextField {
[theTextField resignFirstResponder];
return YES;
}
Now, you’ll discover that, when you tap Return on the keyboard, the key-
board kindly lowers itself.
You’ll also be aware of a couple of features that come with using a text field.
If, after the user enters text in a text field, he or she just happens to shake
the iPhone, the Undo dialog will present itself, as shown in Figure 1-13. To
do this on the Simulator (which is what you see in the figure), simply choose
HardwareShake Gesture and you’ll see what’s displayed in Figure 1-13
firsthand.
You’ll also notice that pressing in a text field brings up the Select and Paste
menu, as shown in Figure 1-14.
Figure 1-13:
Undo typing.
41_542934-bk07ch01.indd 76241_542934-bk07ch01.indd 762 3/26/10 10:32 PM3/26/10 10:32 PM