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
这篇关于使用“•••••••"隐藏密码在文本字段中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用“•••••••"隐藏密码在文本字段中
基础教程推荐
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01