使用“•••••••"隐藏密码在文本字段中 [英] Hide password with "•••••••" in a textField

查看:29
本文介绍了使用“•••••••"隐藏密码在文本字段中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中有一个文本字段,用户必须在其中输入密码,我希望当他输入一个字符时将其更改为•"我该怎么做?

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

这篇关于使用“•••••••"隐藏密码在文本字段中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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