I have a need to display a UITableView
containing a user's account credentials. For this, I'm using UILabels
in UITableViewCell
. When I display their password, I'd obviously like to just display a placeholder password character instead of their actual password, similar to a UITextField
when it's set to secure text entry mode. In fact, I'd like to use the same character as UITextField
uses, instead of '*'.
My question is, what is the character code for the password character the UITextField
when it's in secure mode?
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;
Why not just use a UITextField, make the field non-editable and change the border style to make it look like a UILabel?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With