How do I display a substitute password character in a UILabel?

后端 未结 6 923
醉话见心
醉话见心 2020-12-25 09:07

I have a need to display a UITableView containing a user\'s account credentials. For this, I\'m using UILabels in UITableViewCell. Whe

6条回答
  •  有刺的猬
    2020-12-25 09:33

    In Swift 3 you can use:

    passwordLabel.text = String(password.characters.map { _ in return "•" })
    

提交回复
热议问题