Is there any way to programmatically detect installed keyboards and/or change the keyboard to a custom keyboard from within your app? As in, if I wanted to show a toolbar above the text keyboard with shortcut buttons to commonly-installed custom keyboards, could I a) detect the keyboard is installed, and b) change to a given keyboard on tap?
This assumes you want the list of keyboards setup in the Settings app under General, Keyboards.
You can determine the primary keyboard:
UITextInputMode *currentMode = [[UITextInputMode activeInputModes] firstObject];
You can determine the possible keyboards
NSArray *possibleModes = [UITextInputMode activeInputModes];
You can determine when the keyboard changes. This is done by listening for the UITextInputCurrentInputModeDidChangeNotification notification.
However, there is no API to change the keyboard.
So you can do everything you need except the most important part.
Related
I have an iOS Keyboard Extension that does not support typing any numbers. Also I have an issue where needsInputModeSwitchKey returns false for textfields where keyboardType is set to UIKeyboardTypeNumberPad. Because of that my keyboard doesn't show button for switching keyboards and user cannot switch to system numpad keyboard.
Is it possible to set somewhere that my keyboard doesn't support number typing? So other apps won't switch to it?
I have a UITextField, and the keyboard shows a mic button, which I'd like to disable. I'm especially concerned that it shouldn't show on iPhone X.
I already disabled the Emoji keyboard by setting the keyboard type to "ASCII Capable". Is there another setting to remove dictation?
We are talking about the mic symbol in lower right corner on an iPhone X.
You should not remove it since this is where users of an iPhone X are expecting it.
Also you can not remove the keyboard switcher on the left.
only if you use a custom view for the keyboard, but why?
As you can see on any other iPhone the mic key is still in the same position.
By changing type of keyboard you can discard things you don't want
textField.keyboardType = UIKeyboardTypeEmailAddress;
above one not exact solution but still that can give some idea regarding keyboard type
Hope this will help you
I am trying to set an installed keyboard as the default input for a UITextField. Imagine you have a custom emoji keyboard called "AwesomeEmojis" and you want that keyboard to be the default keyboard programmatically . I have this code:
NSObject[] installedKeyboards = NSUserDefaults.StandardUserDefaults.ArrayForKey("AppleKeyboards");
I am able to see the list of keyboard in a NSMutableString format like:
"awesomeemoji#sw=AwesomeEmoji"
Is there any way that i can do something like:
AwesomeTextField.InputView = FromSystemKeyboards["awesomeemoji#sw=AwesomeEmoji"];
Please keep in mind the it's not a system keyboard. It's installed keyboard.
Thanks!
I'm making a custom keyboard so at first wanna make the one similar with real iOS keyboard.
On the iOS keyboard when I tap [123] button, the alphabet keys changes to number keys. THIS is what I want to do.
Is there any special ways for this?
self.textField.keyboardType = UIKeyboardType.NumberPad
Just noticed that in UITextView keyboard comes without change language button, unlike in UITextField. Why Apple removed this button from UITextView keyboard? Is there any way to enable this button? I want people to be able to write notes on any keyboard language added in phone settings.
EDITED: Maybe it will help somebody in the future. Just noticed that I set keyboard type to UIKeyboardTypeAlphabet and this option eliminates language button. Closing this question.
P.S. I have 3 languages enabled in test iPhone.
You are completely wrong. there is no difference in UIKeyboard in iOS whatsoever. It only depends on what keyboard types you use.
UIKeyboardTypeDefault and UIKeyboardTypeEmailAddress and UIKeyboardTypeTwitter all have those.
You set it like this:
txtField.keyboardType = UIKeyboardTypeTwitter;
UIKeyboardTypeDefault is obviously the default one for any UITextView or UITextField in iOS.
For anyone have this problem even when using UIKeyboardTypeDefault on a UITextView, go into the storyboard and make sure "Secure Text Entry" is unchecked. After unchecking this, the keyboard selector will return as well as the quick type keyboard.