Michel
Michel

Reputation: 11755

How to disable Japanese-mode input on a UITextField object?

I have a simple question. In an iApp in Japanese I have one UITextField object which do not need Japanese input. Is it possible to disable Japanese-mode input only for this one object. (That would make the input much easier for the user)

I have already tried:

myTextField.autocorrectionType=UITextAutocorrectionTypeNo;

and it does not work.

Thanks for any tip.

Upvotes: 0

Views: 850

Answers (1)

naota
naota

Reputation: 4718

UITextField has keyboardType property. When the keyboardType is set to UIKeyboardTypeDefault, Japanese keyboard could be shown as a default keyboard.

typedef enum {
   UIKeyboardTypeDefault,
   UIKeyboardTypeASCIICapable,
   UIKeyboardTypeNumbersAndPunctuation,
   UIKeyboardTypeURL,
   UIKeyboardTypeNumberPad,
   UIKeyboardTypePhonePad,
   UIKeyboardTypeNamePhonePad,
   UIKeyboardTypeEmailAddress,
   UIKeyboardTypeDecimalPad,
   UIKeyboardTypeTwitter,
   UIKeyboardTypeAlphabet = UIKeyboardTypeASCIICapable
} UIKeyboardType;

To set keyboadType Programmatically, you can use setKeyboardType as folows:

[myTextField setKeyboardType:UIKeyboardTypeASCIICapable];

The document is here:

http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITextInputTraits_Protocol/Reference/UITextInputTraits.html

Upvotes: 2

Related Questions