Hide password with quot;•••••••quot; in a textField(使用“•••••••隐藏密码在文本字段中)
问题描述
在我的应用程序中有一个文本字段,用户必须在其中输入密码,我希望当他输入一个字符时将其更改为•"我该怎么做?
In my app there is a textField where the user have to put is password in and i want that when he enter a character it change it to '•' how can i do this?
推荐答案
可以直接在Xcode中实现:
You can achieve this directly in Xcode:
最后一个复选框,确保 secure
被选中.
The very last checkbox, make sure secure
is checked .
或者你可以使用代码来实现:
Or you can do it using code:
标识文本对象是否应该隐藏正在输入的文本.
Identifies whether the text object should hide the text being entered.
声明
optional var secureTextEntry: Bool { get set }
讨论
此属性默认设置为 false
.将此属性设置为 true
会创建一个密码样式的文本对象,它会隐藏正在输入的文本.
This property is set to false
by default. Setting this property to true
creates a password-style text object, which hides the text being entered.
示例:
texfield.secureTextEntry = true
这篇关于使用“•••••••"隐藏密码在文本字段中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用“•••••••"隐藏密码在文本字段中


- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01