title: Auto transliteration in UITextField
body: <p>The model problem: i want to auto convert all 1 to 0 under input in text field.</p>
  
  <p>I try the following:</p>
  
  <pre><code>UITextField *textField = ...
  textField.delegate = self.
  textField.secureTextEntry = YES;
  </code></pre>
  
  <p>...................</p>
  
  <pre><code>- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
  {
      BOOL ret = YES;
  
      if ([string isEqualToString:@"1"]) {
          NSString *text = @"0";
          textField.text = [textField.text stringByAppendingString:text];
          ret = NO;
      }
  
      return ret;
  }
  </code></pre>
  
  <p>Now two cases:</p>
  
  <p>1) we put focus in textField, type "1" then type "2". Result: text field contains only "2", "1" vanishes.</p>
  
  <p>2) we put focus in textField, type anything but not "1" (for example "3"), then delete it, then type "1" and "2". Now we see that text field contains "12"!</p>
  
  <p>What is the difference between these cases? Why does "1" vanishes in the 1st case after typing the next symbol?</p>
  
  <p>P.S. Sorry, I forgot to write the definition of the textField. It is very important that it is of password type! If we try with ordinary textField, my code works perfectly.</p>