加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

iphone – Xcode中的数字键盘

发布时间:2020-12-14 19:49:01 所属栏目:百科 来源:网络整理
导读:有没有人知道如何在 iphone中显示数字键盘而不是默认键盘?有没有一种方法来过滤数字的文本字段?我需要从代码不是从界面构建器 谢谢 解决方法 或者,在代码中设置textfield的keyboardType属性: textField.keyboardType = UIKeyboardTypeNumberPad 可用选项
有没有人知道如何在 iphone中显示数字键盘而不是默认键盘?有没有一种方法来过滤数字的文本字段?我需要从代码不是从界面构建器

谢谢

解决方法

或者,在代码中设置textfield的keyboardType属性:

textField.keyboardType = UIKeyboardTypeNumberPad

可用选项有:

UIKeyboardType The type of keyboard to
display for a given text-based view.

typedef enum {
UIKeyboardTypeDefault,
UIKeyboardTypeASCIICapable,
UIKeyboardTypeNumbersAndPunctuation,
UIKeyboardTypeURL,
UIKeyboardTypeNumberPad,
UIKeyboardTypePhonePad,
UIKeyboardTypeNamePhonePad,
UIKeyboardTypeEmailAddress,
UIKeyboardTypeAlphabet =
UIKeyboardTypeASCIICapable }
UIKeyboardType;

一个谨慎的说法,但是NumberPad没有输入的小数点.如果你需要,你必须使用别的东西.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读