How to create a custom keyboard

HM1 picture HM1 · Jan 10, 2011 · Viewed 48.4k times · Source

How do I go about creating a custom keyboard/keypad that will show up when some one taps on a UITextField? I would like to display a keypad with a, b, c, 1, 2, 3 and an enter button, nothing else. The keypad should work and behave like the standard keyboard does (in behavior) but it will definitely look different.

I can't find any example and the best I've found is to filter characters with existing keyboard which is an unacceptable solution.

Answer

Jonah picture Jonah · Jan 10, 2011

I think you're looking for the "Text, Web, and Editing Programming Guide for iOS"

The UIKit framework includes support for custom input views and input accessory views. Your application can substitute its own input view for the system keyboard when users edit text or other forms of data in a view. For example, an application could use a custom input view to enter characters from a runic alphabet. You may also attach an input accessory view to the system keyboard or to a custom input view; this accessory view runs along the top of the main input view and can contain, for example, controls that affect the text in some way or labels that display some information about the text.

To get this feature if your application is using UITextView and UITextField objects for text editing, simply assign custom views to the inputView and inputAccessoryView properties. Those custom views are shown when the text object becomes first responder...


This might serve as a good introduction: customizing the iOS keyboard