How to Show Specific Language Keyboard When User Input Values in Uitextfield in iPhone App

Showing IPhone keyboard in different languages based on user input

Unfortunately, you cannot control the language of the keyboard. The user chooses which keyboards they would like available via the settings application and can toggle between them using the globe icon on the keyboard. When the keyboard is opened it will open to the most recently used keyboard.

Keyboard language getting change if i change the device language

Unfortunately for built in keyboard restricting localisation is not possible. Anyways you can handle the data gracefully. Just follow this link

UITextField's numerical pad: dot instead of comma for float values

or you can also make your own custom keyboard and set it as the keyboard type for your TextField. This would solve the problem once and for all.

Hope it helps you out.

iPhone: Change Keyboard language programmatically

No this is not possible - user can only change their language in the settings.

However you can give the user an "English" keyboard if you choose (or ask them their preference)

you do this using: UIKeyboardTypeASCIICapable

You can change keyboard directly on the keyboard by pressing "globe icon" on the bottom row.

First, you have to enable those language for input in Settings. Then pressing the globe button on the keyboard would toggle between those languages.

Programmatically change UITextField Keyboard type

There is a keyboardType property for a UITextField:

typedef enum {
UIKeyboardTypeDefault, // Default type for the current input method.
UIKeyboardTypeASCIICapable, // Displays a keyboard which can enter ASCII characters, non-ASCII keyboards remain active
UIKeyboardTypeNumbersAndPunctuation, // Numbers and assorted punctuation.
UIKeyboardTypeURL, // A type optimized for URL entry (shows . / .com prominently).
UIKeyboardTypeNumberPad, // A number pad (0-9). Suitable for PIN entry.
UIKeyboardTypePhonePad, // A phone pad (1-9, *, 0, #, with letters under the numbers).
UIKeyboardTypeNamePhonePad, // A type optimized for entering a person's name or phone number.
UIKeyboardTypeEmailAddress, // A type optimized for multiple email address entry (shows space @ . prominently).
UIKeyboardTypeDecimalPad, // A number pad including a decimal point
UIKeyboardTypeTwitter, // Optimized for entering Twitter messages (shows # and @)
UIKeyboardTypeWebSearch, // Optimized for URL and search term entry (shows space and .)

UIKeyboardTypeAlphabet = UIKeyboardTypeASCIICapable, // Deprecated

} UIKeyboardType;

Your code should read

if(user is prompted for numeric input only)
[textField setKeyboardType:UIKeyboardTypeNumberPad];

if(user is prompted for alphanumeric input)
[textField setKeyboardType:UIKeyboardTypeDefault];


Related Topics



Leave a reply



Submit