I\'m stuck with a problem of changing language for the password field. In my application I need to enter login/password in hebrew with no care of current locale. When I try
Optimized @lonlywolf answer to better performance code: Optimized only two methods where are cycles, which slowed down program when typing more than 30 symbols
- (void)hideTextInTextFieldExceptOne:(NSString *)string
{
int lenght = [passwordTextField.text length];
if (lenght -1 > 0) {
NSString *resultString = @"";
for (int i = 0; i < lenght-1; i++)
{
resultString = [resultString stringByAppendingFormat:@"*"];
}
NSRange range = NSMakeRange(0, lenght - 1);
passwordTextField.text = [fieldPassword.text stringByReplacingCharactersInRange:range withString:resultString];
}
}
- (void)hideTextInTextField
{
int lenght = [passwordTextField.text length];
if (lenght > 0) {
NSString *resultString = @"";
for (int i = 0; i < lenght; i++)
{
resultString = [resultString stringByAppendingFormat:@"*"];
}
passwordTextField.text = resultString;
}
}