keyboardscroll -- UITextField and the virtual keyboard
by allen brunson april 20 2009
allen.brunson@gmail.com


Overview
--------

Example project that shows how to use UITextField with the iPhone's virtual keyboard.  By default, the virtual keyboard will probably cover up the text field being edited, which is a tad sub-optimal.  This program illustrates two methods to overcome this problem, depending on what type of view you're using.


Method 1: UITableView
---------------------

If you've got UITextFields inside a UITableView, you'll want to do something similar to the TableViewController class, included in this project.  It derives from UITableViewController, a class provided by UIKit.  This works in iPhone OS 2.2 and later, which was the first version with the added virtual keyboard support.


Method 2: Other view types
--------------------------

For other view types, you'll want to derive your own class from WBKeyboardViewController, which contains logic for making UITextFields jump out of the way when the virtual keyboard is about to appear.  This is a class I wrote myself, since UIKit provides no help, except for UITableViews.

To use WBKeyboardController in your own programs, add the three files WBKeyboardController.mm, WBKeyboardController.h, and WBGeometry.h to your Xcode project.  You shouldn't have to modify those three files at all.  Finally, derive your own class from WBKeyboardController and put your own custom view logic into it.  TextFieldViewController is an example class in this project that shows you how to go about it.


Other project classes
---------------------

AppController is a fairly standard application delegate object.  One wrinkle is that this project uses absolutely no NIBs or XIBs, so this class knows how to set itself up without them.

WBImage is a helper class that adds a few methods to the UIImage class.  One of them is a method for creating 30x30-pixel images from unicode characters, which are perfect for placeholder art on tab bars.
