Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 10. Working with Text > Recipe: Creating a Custom Input View

Recipe: Creating a Custom Input View

Custom input views allow you to replace the keyboard with a view of your design whenever a text view or text field becomes first responder. You can add custom input views to non-text views as well as to text ones. This is covered later in this chapter in Recipe 10-7. For now, Recipe 10-5 focuses on the text scenario.

Whenever you set the inputView property, whatever view is assigned to that property is scrolled in and displayed in place of the system keyboard. The easiest way to demonstrate this feature is to create a colored view and assign it to the inputView property. Consider the following code snippet that creates two text fields. The second fields’ inputView property is set to a basic UIView instance with a purple background. You can see the results of this code in Figure 10-6. When the first text field becomes first responder, the keyboard appears; when the second field is selected, the purple view appears instead.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial