How to set the default side number (with the keyboard open) of the keyboard name of the keyboard of the keyboard

Now, when the keyboard starts up in my application, it by default points to the letter side showing the alphabetical keyboard.

The question will be listed below images

See image below:

enter image description here

This is good . When you press 123, the number will be displayed.

enter image description here

Question:

However, I want to show the number from the side by default and still be able to return to the side of the letter later WHEN THE KEYBOARD IS OPEN. How to do it?

Programming another type of keyboard is NOT the answer!

For example ... The user clicks in the text box, the keyboard pops up and by default allows you to talk to ABC. User can press 123 to switch. This is what I want. If the ability to switch with the keyboard open is taken away, it strikes at the heart of the matter.

Thus, if the default Name Phone Pad is used on the ABC side. I want it to be on side 123 by default, while the keyboard is still open, it can switch back to ABC when the user presses the ABC button.

I want to do this because I have different settings for finding barcodes. Or by the name of the product or number based on the settings, the user sets the indexing order of the results. Thus, if they are sorted by numbers, numbers are offered first, but they can still return to alphabetical search if they want by pressing the ABC button on the keyboard.

Here is the current setting for my keyboard.

enter image description here

+5
source share
2 answers

keyboardType is a property for UITextField .

textField.keyboardType = UIKeyboardType.UIKeyboardTypeNumberPad 

and

 textField.keyboardType = UIKeyboardType.UIKeyboardTypeDefault 

is how you can programmatically switch between the two modes. Hope this helps.

+3
source

To programmatically switch from Keyboardlayout, you need to change the classType attribute for the UITextfield attribute.

Try

 textField.keyboardType = UIKeyboardType.NumberPad; 

or

 textField.keyboardType = UIKeyboardType.PhonePad; 
0
source

Source: https://habr.com/ru/post/1246854/


All Articles