如何在iPhone上默认显示数字键盘? [英] How can I show the numeric keyboard by default on iPhone?

查看:1074
本文介绍了如何在iPhone上默认显示数字键盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试以下方法,但是没有运气.当用户单击UiTextfield时,我需要自动将键盘视图更改为数字视图,这可能吗?

I'm trying the following with no luck. When the user click on a UiTextfield I need to change the keyboard view to the numeric view automatically, is this possible?

推荐答案

UITextInputTraits 协议(符合UITextField的协议)具有类型为UIKeyboardTypekeyboardType属性.

The UITextInputTraits protocol (which UITextField conforms to) has a keyboardType property of type UIKeyboardType.

myTextField.keyboardType = UIKeyboardTypeNumberPad;

这篇关于如何在iPhone上默认显示数字键盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆