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
这篇关于使用“•••••••"隐藏密码在文本字段中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用“•••••••"隐藏密码在文本字段中
基础教程推荐
- AdMob 广告未在模拟器中显示 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
