international keyboard customized?

岁酱吖の 提交于 2019-12-04 21:40:59

In iOS 4.2 and later, you can use the UITextInputMode class to determine the primary language currently being used for text input.

[UITextInputMode currentInputMode].primaryLanguage will give you an NSString representing the BCP 47 language code such as “es”, “en-US”, or “fr-CA”.

You can register for the UITextInputCurrentInputModeDidChangeNotification to be alerted when the current input mode changes.

As Thomas Müller said, Internationalization Programming Topics is a good place to start.

You might also be interested in the "Getting Your Apps Ready for China and other Hot New Markets" WWDC session.

Have a look at the Internationalization Programming Topics on the iPhone Dev Center.

There is no documented way to know when keyboard changes, nor a documented way to get the current keyboard mode.


With undocumented APIs, you can listen to the UIKeyboardCurrentInputModeDidChangeNotification local notification.

The current input mode can be found from the com.apple.Preferences preferences, using

return CFPreferencesCopyAppValue(CFSTR("KeyboardLastUsed"),
        CFSTR("/var/mobile/Library/Preferences/com.apple.Preferences"));

(Note: to test on simulator you need to replace /var/mobile/ by /Users/<user-name>/Library/Application Support/iPhone Simulator/<sdk-version>/.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!