How to add a numeric and decimal keyboard to my custom keyboard on iOS8?

I created a custom keyboard in Swift, but it was rejected from the App Store because: "the keyboard extension does not include numbers and decimal types."

How can I easily add these two keyboards?

I tried to restore the original view, but it does not work properly. I am sure that there is a decision to create 2 or 3 different types and switch between them.

How can I switch between keyboard types when changing keyboard type?

+4
source share
1 answer

textDidChange. UITextDocumentProxy, - keyboardType, .

override func textDidChange(_ textInput: UITextInput?) {
    // Called when the document context is changed - theme or keyboard type changes

    let proxy = self.textDocumentProxy as UITextDocumentProxy
    if proxy.keyboardType == UIKeyboardType.numberPad
        || proxy.keyboardType == UIKeyboardType.decimalPad {
        //add code here to display number/decimal input keyboard
    }
}
+2

All Articles