IOS 8 UIKeyboardType Custom Keyboard Extension

I am creating a custom keyboard for iOS 8, and I would like to change the keyboard layout based on UIKeyboardType, however, reading the keyboard type in UIInputViewController is always 0. Any suggestions? Thanks in advance!

- (void)viewDidLoad
{
    [super viewDidLoad];

    NSLog(@"TextInputMode: %ld", self.textDocumentProxy.keyboardType);
}
+4
source share
2 answers

Get keyboardTypein the delegate methods an InputView instead of ViewDidLoad. Because you cannot get the type of keyboard until the keyboard is fully represented and the input object is activated.

- (void)textWillChange:(id<UITextInput>)textInput {

    NSLog(@"TextInputMode: %ld", self.textDocumentProxy.keyboardType);

}

OR

- (void)textDidChange:(id<UITextInput>)textInput {

    NSLog(@"TextInputMode: %ld", self.textDocumentProxy.keyboardType);

}
+6
source

(not enough comments to add a comment sorry)

textDidChange - , keyType . textWillChange, , .

+1

All Articles