更改 UITextfield 中的安全密码字符
是否可以更改显示的安全密码字符?
Is it possible to change the secure password character displayed ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
是否可以更改显示的安全密码字符?
Is it possible to change the secure password character displayed ?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
假设鲍比 B 是对的,不可能改变秘密角色,
我在此提出,
没有任何保证且有所有适用的警告,
因为这是一个可怕的拼凑,在某些时候肯定会让你头疼,
希望不要对其投太多反对票:
将您的
UITextField
委托设置为包含此函数的类。只需确保您有
self.backing
,它是保留的NSString*
。需要复制和粘贴拼凑来保留光标位置。我对粘贴一无所知,这是一个疯狂的猜测,它确实有效,但您确实需要找出这是否会导致这方面的问题。我测试了一下,似乎没有出现任何问题。
Assuming Bobby B is right in that it is impossible to change the secret character,
I hereby present,
with no guarantuee whatsoever and with all warnings that are applicable,
since this is a horrible kludge which will certainly give you headaches at some point,
hoping not to be downvoted too much for it:
Set your
UITextField
's delegate to the class containing this function.Just make sure you have
self.backing
which is a retainedNSString*
. The copy&paste kludge was needed to preserve cursor position.I don't know anything about pasting, this was a wild guess and it works, but you do need to find out if this may lead to some problem in that respect. I tested a little and it didn't seem to give any problem.
您也可以只更改字体...
如果更改 unicode 字符“BULLET”(U+2022),您可以自定义秘密字符。
有很多免费的字体编辑器。
我使用这个 http://www.cr8software.net/typex.html
来添加自定义字体对于您的项目,请查看 - 此链接< /a>
这非常简单,
然后您无需编写任何代码即可正常工作。
You could also just change the font...
If you change the unicode character 'BULLET' (U+2022) you can customise the secret character.
There are a lot of free font editor out there.
I use this one http://www.cr8software.net/typex.html
To add custom fonts to your project, check out - this link
It's quite easy
Then you don't have to code anything it just works.
我认为这是不可能的,并且我的基础是在文档中缺少 UITextInputTraits (专门针对 secureTextEntry)。
但也可能是错的——有兴趣听听以前是否有人这样做过。
祝你好运!
I don't think that this is possible, and I'm basing that on a lack of documentation found in the docs for UITextInputTraits (specifically for secureTextEntry).
Could be wrong though - interested to hear if someone has done this before.
Good luck!
简而言之,允许在 IB 中或通过程序保护财产。
Simply, allow Secure property in IB or via program.