Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top