在具有安全文本条目的UITextField上忽略UIKeyboardTypeNumbersAndPunctuation

时间:2010-09-01 17:09:03

标签: iphone uitableview uitextfield uikeyboard

我有一个代表数字密码的UITextField。我需要同时将键盘类型设置为UIKeyboardTypeNumbersAndPunctuation和secureTextEntry。

如果我将secureTextEntry设置为Yes,则即使我已将UIKeyboardTypeNumbersAndPunctuation设置为textField键盘类型,textField也会显示默认键盘。

另一方面,如果我将键盘类型设置为UIKeyboardTypeNumberPad它工作正常,但我没有完成/返回键来关闭该键盘。 = S

是否有解决方案或解决方法?

谢谢!

1 个答案:

答案 0 :(得分:6)

我不知道这是不是一个错误...

我从

更改了代码

XXX.KeyboardType = UIKeyboardTypeNumbersAndPunctuation

XXX.secureTextEntry = YES

XXX.secureTextEntry = YES

XXX.KeyboardType = UIKeyboardTypeNumbersAndPunctuation

然后,它有效......