iOS

Pick the right on-screen keyboard for your iOS App

It is important for iOS developers to use the appropriate keyboard layout for any given situation.

When it comes to discussions surrounding hardware versus software keyboards, there is no shortage of soapboxes within the opinion-riddled mobile device user community. It has been nearly six years since the introduction of the iPhone (July 29, 2007) and its controversial software keyboard. As with most trail-blazing innovations, the value is theoretical - at first. As time goes by, however, trendy innovations become part of everyday life. On-screen keyboards have become the norm, and certainly the only choice for iOS devices.

There are many benefits of an on-screen keyboard. One benefit is based on the concept of a "situation-specific" keyboard changing to be relevant to the current needs of the iOS app. When the user is attempting to enter a URL into the address bar of a browser, why not have a single button for typing ".com?" Moreover, a space is not allowed in web addresses, so why include a spacebar on the keyboard layout? Customizing the keyboard to match certain situations eliminates input errors. It is important for iOS developers to use the appropriate keyboard layout for any given situation.

iOS keyboards types

The four most common keyboard types are (1) the default keyboard, (2) the URL keyboard, (3) the e-mail keyboard, and (4) phone keyboard. Each of the keyboard types is designed for specific situations and should be used in accordance with Apple's Design Guidelines. The full list of keyboards available for use within an iOS app includes:

  • Default
  • ASCII Capable
  • URL
  • Number Pad
  • Phone Pad
  • Name Phone Pad
  • E-mail Address
  • Decimal Pad
  • Twitter
Every input object within an iOS app where a keyboard or number pad would typically be used has a specific keyboard type assigned. If the developer does not select a keyboard type, the default keyboard is used (Figure A).

Figure A

There are two keyboard layouts, and the keyboard type is a parameter controlling the keys within each layout. The default keyboard, for example, contains all of the basic input keys that would be used for general text input. This keyboard layout includes several views allowing the user to toggle between the initial alphabetical keyboard to the numeric and punctuation views. The language preferences for the iOS device controls the characters mapped to each layout as well as the input method or flow.

Here is a breakdown of iOS 6 keyboard types: UIKeyboardType

1. Keyboard Type: Default
  • Constant: UIKeyboardTypeDefault
  • Description: A basic QUERTY keyboard with additional views for punctuation and numbers (Figure B).

Figure B

2. Keyboard Type: ASCII Capable
  • Constant: UIKeyboardTypeASCIICapable
  • Description: A standard keyboard layout displaying standard ASCII characters.
3. Keyboard Type: Numbers and Punctuation
  • Constant: UIKeyboardNumbersAndPunctuation
  • Description: Use the alternate numbers and punctuation view of the default keyboard.
4. Keyboard Type: URL
  • Constant: UIKeyboardTypeURL
  • Description: Includes URL-friendly keys - such as a ".com" and "." key - and does not include the spacebar (Figure C).

Figure C

5. Keyboard Type: Number Pad
  • Constant: UIKeyboardTypeNumberPad
  • Description: Standard numeric keypad.
6. Keyboard Type: Phone Pad
  • Constant: UIKeyboardTypePhonePad
  • Description: Layout similar to the number pad, but keys arranged for dialing a phone number (Figure D).

Figure D

7. Keyboard Type: Name Phone Pad
  • Constant: UIKeyboardNamePhonePad
  • Description: Keyboard layout for entering an individual's name or phone number.
8. Keyboard Type: E-mail Address
  • Constant: UIKeyboardEmailAddress
  • Description: Layout for entering an email address. Includes the "@" symbol as well as a "." character (Figure E).

Figure E

9. Keyboard Type: Decimal Pad
  • Constant: UIKeyboardDecimalPad
  • Description: Similar to a standard number pad. Includes numbers and a decimal point.
10. Keyboard Type: Twitter
  • Constant: UIKeyboardTwitter
  • Description: Keyboard with easy access to the "#" and "@" characters for composing tweets.

With so many options available, it is important to select the keyboard layout appropriate to the situation. The idea is to select a keyboard layout that:

  1. Will produce the best user experience, and
  2. Result in the least amount of user input mistakes.

Using the E-mail keyboard type, for example, eliminates the possibility of a user entering a non-conforming space character as part of an address. Make sure to consider all of the possible variations a user might need to enter into a given field and choose the best keyboard layout.

User interface considerations

When user input is required in an iOS app, the developer should consider all types of input controls. In other words, a keyboard may not be the best choice in a recipe app where the user is tasked with entering measurement values and units. A keyboard would allow for freeform input, whereas a UIPickerView would be a better choice. It would be easier - with consistent results - to calculate values entered from a picker control than from freeform text fields.

In the event a keyboard is the best option, make sure to review and set all of the properties for managing the keyboard behavior. Depending on the keyboard type, additional properties can be set. The non-numeric keyboard types support auto-capitalization, auto-correction, and spell checking. If the input field is to contain sensitive information - such as a PIN number or password - consider setting secureTextEntry property.

Final thoughts

On-screen keyboards have much more versatility than fixed hardware keyboards. Some users prefer hardware keyboards because they can type without looking at the keypad - a nearly impossible task on the iOS devices. However, the benefits of an on-screen keyboard outweigh the limitations. Hardware manufacturers also recognize the advantages of this technology.

An on-screen keyboard supports many languages without the need to produce language-specific hardware. Research in Motion (RIM) developed their Blackberry Z10 with a touchscreen keyboard. While you cannot "feel" the keys on this new device, the on-screen keyboard is capable of learning how you type as well as predicting the words you are entering.

Technology companies are constantly innovating and developing solutions to make their products better. The on-screen keyboard is an innovation that has gained momentum in the past few months. The Twitter keyboard layout, for example, would not have been a consideration a few years ago. Remember to take advantage of the iOS device's capabilities, and leverage the versatility of the on-screen keyboard.

Also read:

About

Gregory Dean is the CTO for the Wilen Group. He has spent the past 25 years in C-level positions setting the tone and direction of technology-driven services organizations. Gregory is constantly researching technologies and developing capabilities to...

1 comments
Mark W. Kaelin
Mark W. Kaelin

Have you used an alternative layout on-screen keyboard for your apps? Do you think now that perhaps you should have?

Editor's Picks