在具有安全文本输入的 UITextField 上忽略 UIKeyboardTypeNumbersAndPunctuation

发布于 2024-09-17 11:33:34 字数 326 浏览 2 评论 0原文

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

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

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

有解决方案或解决方法吗?

谢谢!

I've got a UITextField that represents a numeric password. I need to set the keyboard type to UIKeyboardTypeNumbersAndPunctuation and secureTextEntry at the same time.

If I set to Yes the secureTextEntry, the textField displays a Default Keyboard even if I had set UIKeyboardTypeNumbersAndPunctuation to the textField keyboard type.

By the other hand, if I set the keyboard type to UIKeyboardTypeNumberPad it works fine, but I have no done/return key to dismiss that keyboard. =S

is there a solution or a workaround for this?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

救赎№ 2024-09-24 11:33:34

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

我将代码从

XXX.KeyboardType = UIKeyboardTypeNumbersAndPunctuation

XXX.secureTextEntry = YES

更改为

XXX.secureTextEntry = YES

XXX.KeyboardType = UIKeyboardTypeNumbersAndPunctuation

然后,它起作用了...

I don't know it is a bug or not...

I changed the code from

XXX.KeyboardType = UIKeyboardTypeNumbersAndPunctuation

XXX.secureTextEntry = YES

to

XXX.secureTextEntry = YES

XXX.KeyboardType = UIKeyboardTypeNumbersAndPunctuation

Then, it works...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文