gpt4 book ai didi

swift - NSSecureTextField 可以显示明文吗?

转载 作者:行者123 更新时间:2023-11-28 08:38:01 43 4
gpt4 key购买 nike

注意:我读过 this question on a similar topic ,但那是两年前的事了,而且是针对 Objective-C。

我有一个 NSSecureTextField,用户可以在其中输入一些文本。在我的代码中的某个时刻,我想让 NSSecureTextField 在触发 NSButton 时显示用户之前输入的确切文本。

示例代码如下:

@IBOutlet var secureText: NSSecureTextField!    // secure text field, with text

@IBAction func switchSecureDisplay(sender: NSButton) {

// here's where I would like to switch secure display to normal plaintext display.
// unfortunately, no such method exists
secureText.displayPlainText()

}

实现这样的方法displayPlainText()是否可行?如果没有,是否有可能的替代解决方法?

最佳答案

两年前也有人问过这个问题,有一个被接受的答案here .

因为你标记了这个 ,您应该知道这可以使用 UITextField 并切换该对象的 secureTextEntry 属性。

关于swift - NSSecureTextField 可以显示明文吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37213658/

43 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com