I am trying to provide a different language support on my iOS 5.x application whenever native Keyboard is opened. Provide this language in native keyboard programmatically. Could someone guide me how can i support it? I saw a carbon framework, but looks like its for Mac apps.
Thanks.
You can do it starting from iOS 7 on a per UIResponder basis. There is textInputMode property in UIResponder class. It is readonly, but the documentation says:
In my project I created a subclass of
UITextField
and defined a new property called userDefinedKeyboardLanguage. I also overrode above mentioned textInputMode method. It looks similar to the following:I have also a custom method +(NSString *)langFromLocale:(NSString *)locale in my Utilities class which looks like this:
Now my custom textfield class can change the keyboard input language simply by setting userDefinedKeyboardLanguage property to the desired language.
This seems to work to change, for instance, to a Greek keyboard:
Declaration:
Use:
Class cTextField:
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.
All great answers. But in Swift you can override methods and variables defined in parent class (
UIResponder
) in an extension. So it's not necessary to subclass. And it's nice to replace thefor
loop with a more swift like one-liner.Instead of "emoji" probably will be something like
Utils.currentAppLanguage
I know it is old question, but here it is my way to change keyboard language.
Thank to @the4kman for the mark: this way can change current keyboard only to those which were added in Settings.
Swift 3: