In this chapter, you learned various techniques for dealing with the keyboard in your iPhone application. In particular, this chapter showed you how to hide the keyboard when you are done entering data, how to detect the presence or absence of the keyboard, and how to ensure that views are not blocked by the keyboard.
Answers to the exercises can be found in Appendix D.
WHAT YOU LEARNED IN THIS CHAPTER
TOPIC | KEY CONCEPTS |
Making the keyboard go away | Use the resignFirstResponder method on a UITextField object to resign its First-Responder status. |
Displaying the different types of keyboard displayed | Modify the keyboard type by changing the text input traits of a UITextField object in the Attributes Inspector window. |
Handling the Return key of the keyboard | Either handle the Did End On Exit event of a UITextField object or implement the textFieldShouldReturn: method in your View Controller (remember to ensure that your View Controller class is the delegate for the UITextField object). |
Making a Scroll View scrollable | Set its frame size and content size. As long as the content size is larger than the frame size, the Scroll View is scrollable. |
Detecting when the keyboard appears or hides | Register for two notifications: UIKeyboardDidShowNotification and UIKeyboardDidHideNotification. |
Detecting which UITextField object has started editing | Implement the textFieldDidBeginEditing: method in your View Controller. |
Detecting which UITextField object has ended editing | Implement the textFieldDidEndEditing: method in your View Controller. |
18.225.95.216