Changes

Jump to: navigation, search

Writing iOS 6 Code to Hide the iPad Keyboard

3 bytes added, 21:18, 6 December 2012
no edit summary
When the user of an iPad iOS 6 app is required to enter data (typically as a result of touching a text input view such as a text field) the keyboard automatically appears on the screen. As illustrated in the preceding chapter, however, the keyboard does not automatically go away when the user has finished typing.
If you have experience of using other iPad applications you will have noticed that pressing the Return key on the keyboard or tapping anywhere on the background of the user interface usually causes the keyboard to recede from view. In actual fact, the developers of these applications had to write some code specifically to implement this functionality. In this chapter we will cover the steps necessary to implement this behavior in your own iOS 6 applications.
14.1 == Creating the Example Application== 
If you are reading this book sequentially you can perform the steps outlined in this chapter using the example application outlined in the previous chapter. For those who are dipping into this book as a reference source and would like to try out a simple example it will first be necessary to create a sample application.
Begin by launching Xcode and creating a new Single View Application based iPad iOS application product named HideKeyboard with the class prefix also set to the same name. From within the main Xcode window select the HideKeyboardViewController.xib file to edit the user interface. Within the Interface Builder panel drag a Text Field object from the Object Library panel (View -> Utilities -> Show Object Library) onto the View area.

Navigation menu