如何在 iOS 中以编程方式更改键盘样式?
how to change keyboard style programmatically in iOS?
我想更改键盘样式。
我附上了两张图片,一张是目前的情况,一张是理想的情况。
试试这个来改变键盘类型:
self.someTextField.keyboardType = UIKeyboardType.decimalPad
对于带有特殊字符的数字试试这个:-
UIKeyboardType.numbersAndPunctuation
来自 :- https://developer.apple.com/documentation/uikit/uitextinputtraits#//apple_ref/c/tdef/UIKeyboardType
非常感谢您的建议和回答。
我找到了解决方案。
for the numbers
textField.keyboardType = UIKeyboardType.numbersAndPunctuation
for the alphabets
textField.keyboardType = UIKeyboardType.emailAddress
- 键盘类型建议
textField.keyboardType = .emailAddress
After = . (Multiple Suggestions for keyboard type you can select according to your usage)
我想更改键盘样式。 我附上了两张图片,一张是目前的情况,一张是理想的情况。
试试这个来改变键盘类型:
self.someTextField.keyboardType = UIKeyboardType.decimalPad
对于带有特殊字符的数字试试这个:-
UIKeyboardType.numbersAndPunctuation
来自 :- https://developer.apple.com/documentation/uikit/uitextinputtraits#//apple_ref/c/tdef/UIKeyboardType
非常感谢您的建议和回答。
我找到了解决方案。
for the numbers
textField.keyboardType = UIKeyboardType.numbersAndPunctuation
for the alphabets
textField.keyboardType = UIKeyboardType.emailAddress
textField.keyboardType = .emailAddress
After = . (Multiple Suggestions for keyboard type you can select according to your usage)