I have designed a custom keyboard extension and I am able to enter text properly. However I can't seem to be able to figure out when to enable a capitalized keyboard and when lowercase. This is mostly because the following functions don't correctly return the already entered before/after text. Sometimes they will return nil, sometimes only a last few characters etc. Many times these methods are not even called at all.
- (void)textWillChange:(id<UITextInput>)textInput
- (void)textDidChange:(id<UITextInput>)textInput
I have figured out the following scenarios when I need to have enable my uppercase keyboard:
Also if the above is possible, is it possible to also get the last entered "entire" word which I can use for dictionary searches like for predictive typing?
I have read the apple document where it states that users expect auto-capitalization, so I am sure this should be possible
https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/Keyboard.html
To use a keyboard shortcut to change between lowercase, UPPERCASE, and Capitalize Each Word, select the text and press SHIFT + F3 until the case you want is applied.
A bevy of apps let you redesign your keyboard. Typewise arranges the keys into an easier-to-type honeycomb shape, while apps like Microsoft's SwiftKey let you type by swiping from key to key (a feature iOS has since adopted) and use a different text prediction tool.
E.G. textField being named of your UITextField instance. Put this after initializing.
textField.autocaptializationType = UITextAutocapitalizationTypeSentences
That should give you capital letters in all of the instances you mentioned.
Ok to make your custom keyboard adopt UITextInputTraits protocol, do the following.
@interface MyCustomKeyboard : UITextInput <UITextInputTraits> //Now adopts the UITextInputTraits protocol.
- (instancetype)init {
self = super.init;
if(self) {
//Here you can set the properties that come with the protocol
self.autocapitilizationType = UIAutocapitalizationTypeSentences;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With