SUMMARY

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.

EXERCISES

  1. How do you hide the keyboard for a UITextField object?
  2. How do you detect whether the keyboard is visible or not?
  3. How do you get the size of the keyboard?
  4. How do you display more views than the View window can display at any one time?

    Answers to the exercises can be found in Appendix D.

image 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.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.95.216