title: Moving focus from UITextfield after entering 2 characters
body: <p>The next code will work only when the user will enter the third character. I want the focus to move TextField when the user enters the second character but still keep the first 2 characters in the first TextField. if I'll try something like<code>newString.length &lt; 2</code> , when entering 2 characters in a row I'll get the first character in the first <code>UITextField</code> and the second character in the second <code>UITextField</code>.</p>
  
  <pre><code>- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
  {
      NSString *newString = [textField.text stringByReplacingCharactersInRange:range withString:string];
  
      if (newString.length &lt;= 2 )
      {
  
          return YES;
      }
      else
      {
          NSInteger nextTag;
          nextTag = textField.tag + 1;
  
          UIResponder* nextResponder = [textField.superview viewWithTag:nextTag];
          if (nextResponder) {
              [nextResponder becomeFirstResponder];
          }
          else {
              [textField resignFirstResponder];            
          }
      }
      return YES;
  }
  </code></pre>