使用密码保护的UITextField上的大写锁定图像 [英] Caps Lock Image on Password Protected UITextField

查看:148
本文介绍了使用密码保护的UITextField上的大写锁定图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个需要使用USB键盘的应用程序. (普通的触摸屏键盘已被禁用,并且不会显示.)当用户第一次安装该应用程序时,他们将需要创建一个四位数的Pin.引脚的输入字段受密码保护(因为每次输入新数字时都会出现点). Pin UITextField最多只能设置为四个数字.其他任何字母/数字都不会添加到UITextField中.这就是它的样子-

I am creating an app that requires the use of a USB Keyboard. (The normal touch screen keyboard has been disabled and will not show up.) When the user installs the app for this first time, they will need to create a four digit Pin. The input field for the Pin is password protected (as in dots will appear every time a new digit is entered). The Pin UITextField is set up to only except four numeric digits. Any other letters/numbers will not be added to the UITextField. This is what it looks like -

链接到图像.

这里的问题是,当用户单击USB键盘上的大写锁定按钮时,大写锁定图像将出现在UITextField中.但是,该字段仅接受数字,因此我不在乎在文本字段中显示大写锁定图像.有什么方法可以删除大写锁定图像?

The problem here is when the user clicks the caps lock button on the USB keyboard, the caps lock image will appear in the UITextField. However, the field only accepts numbers, so I don't care to show a caps lock image in the text field. Is there a way I can remove the caps lock image?

推荐答案

在rightView上添加虚拟视图可以解决问题.感谢您的输入.

Adding a dummy view to the rightView did the trick. Thanks for the input.

textField.rightView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 0))

这篇关于使用密码保护的UITextField上的大写锁定图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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