-2

I Created a keyboard extension like this:

enter image description here

But I don't know where to define my custom keyboard to be a numeric pad. If any number type textfield tapped by user, the iOS default numeric pad will present with no switch button to my custom numeric pad.

The question is:

How to define my custom keyboard to be a numeric pad?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Ahmadreza
  • 6,950
  • 5
  • 50
  • 69

1 Answers1

3

From Apple's docs Custom Keyboard:

Your custom keyboard is also ineligible to type into so-called phone pad objects, such as the phone number fields in Contacts. These input objects are exclusively for strings built from a small set of alphanumeric characters specified by telecommunications carriers and are identified by having one or another of the following two keyboard type traits:

  • UIKeyboardTypePhonePad
  • UIKeyboardTypeNamePhonePad

When a user taps in a phone pad object, the system temporarily replaces your keyboard with the appropriate, standard system keyboard. When the user then taps in a different input object that requests a standard keyboard via its type trait, your keyboard automatically resumes.

So, it looks like you cannot do what you're asking.

DonMag
  • 69,424
  • 5
  • 50
  • 86
  • 1
    OK Thanks, but how about a decimal or email keyboard? – Ahmadreza Dec 04 '18 at 13:36
  • 1
    From that same doc page: *To present a keyboard layout appropriate to the current text input object, respond to the object’s UIKeyboardType property. For each trait you support, change the contents of your primary view accordingly.* – DonMag Dec 04 '18 at 13:41