I have a need to display a UITableView
containing a user\'s account credentials. For this, I\'m using UILabels
in UITableViewCell
. Whe
Here's a way to do this, e.g., to display the password "dotted out" in a Prototype Cell's detailTextLabel:
// self.password is your password string
NSMutableString *dottedPassword = [NSMutableString new];
for (int i = 0; i < [self.password length]; i++)
{
[dottedPassword appendString:@"●"]; // BLACK CIRCLE Unicode: U+25CF, UTF-8: E2 97 8F
}
cell.detailTextLabel.text = dottedPassword;
The password character is probably a bullet. On a Mac, option-8 will insert one wherever you are typing. The Character Palette says it is Unicode 2022 and UTF8 E2 80 A2.
In Swift 3 you can use:
passwordLabel.text = String(password.characters.map { _ in return "•" })
In iOS 10, the BLACK CIRCLE Unicode character is not consistent with the secure text field anymore. The character to use is ⦁ "Z NOTATION SPOT" (U+2981).
Why not just use a UITextField, make the field non-editable and change the border style to make it look like a UILabel?
Although a very old question, I came across the same problem. benzado has the right idee, although I think the Unicode should be 25cf. To me it looks like that's exactly the dot apple uses in a secured UITextField.