小编Far*_*nen的帖子

触摸空格键时如何防止键盘从数字更改为字母?

UITextFields在桌子上输入值.其中一些字段仅接受数字.我UIKeyboardTypeNumbersAndPunctuation用于keyboardType,并shouldChangeCharactersInRange过滤字符.

此外,所有更正都被禁用:

textField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
textField.autocorrectionType =  UITextAutocorrectionTypeNo;
textField.autocapitalizationType =  UITextAutocapitalizationTypeNone;
Run Code Online (Sandbox Code Playgroud)

在仅数字字段上,触摸空格键时,键盘将更改为字母.我知道这是默认行为.我想忽略空格键,不希望键盘类型改变.

有没有办法改变这种默认行为?

PS:其他数字键盘类型不是一个选项.我需要标点符号!

谢谢

iphone uitextfield iphone-sdk-3.0

5
推荐指数
1
解决办法
1047
查看次数

标签 统计

iphone ×1

iphone-sdk-3.0 ×1

uitextfield ×1