How can I set the label of my UITableViewCell to "SecureText"?
[cell.textLabel setText:@"passwordNotShown"];
How can I set the label of my UITableViewCell to "SecureText"?
[cell.textLabel setText:@"passwordNotShown"];
UILabel
doesn't have a secure property, you'll have to create a custom cell with a non-editable UITextField
with the secure property set.
UILabel doesn't have 'secure entry' how about setting masked string as label text?
NSString *secretText = @"sekert";
NSMutableString *masked = [[NSMutableString alloc] init];
for (int i=0; i < [secretText count] ; i++)
[masked appendString:@"*"]; //
cell.textLabel.text = masked;
[masked release];
You might use a category:
@interface UILabel (SecureText)
@property (nonatomic, retain) NSString *secureText;
@end
@implementation UILabel (SecureText)
- (void)setSecureText:(NSString *)newText {
NSMutableString *securedMutableText = [NSMutableString new];
for (int i = 0; i < [newText length]; i++) {
[securedMutableText appendString:@"*"];
}
self.text = securedMutableText;
}
- (NSString *)secureText {
return self.text;
}
@end
and then use it like this:
[cell.textLabel setSecureText:@"passwordNotShown"];