title: UITextField: move view when keyboard appears
body: <p>I'm currently working on an iPhone application with a single view, which has multiple UITextFields for input. When the keyboard shows, it overlays the bottom textfields. So I added the corresponding <code>textFieldDidBeginEditing:</code> method, to move the view up, which works great:</p>
  
  <pre><code>- (void)textFieldDidBeginEditing:(UITextField *)textField {
      if ( ( textField != inputAmount ) &amp;&amp; ( textField != inputAge ) ) {
          NSTimeInterval animationDuration = 0.300000011920929;
          CGRect frame = self.view.frame;
          frame.origin.y -= kOFFSET_FOR_KEYBOARD;
          frame.size.height += kOFFSET_FOR_KEYBOARD;
          [UIView beginAnimations:@"ResizeForKeyboard" context:nil];
          [UIView setAnimationDuration:animationDuration];
          self.view.frame = frame;
          [UIView commitAnimations];      
      }
  }
  </code></pre>
  
  <p>This method checks, if the source of the message is one of the textfields that are visible when the keyboard shows, and if not, it moves the view up.</p>
  
  <p>I also added the <code>textFieldDidEndEnditing:</code> method, which moves the view down again (and updates some model objects according to the changed input):</p>
  
  <pre><code>- (void)textFieldDidEndEditing:(UITextField *)textField {
      if ( ( textField != inputMenge ) &amp;&amp; ( textField != inputAlter ) ) {
          NSTimeInterval animationDuration = 0.300000011920929;
          CGRect frame = self.view.frame;
          frame.origin.y += kOFFSET_FOR_KEYBOARD;
          frame.size.height -= kOFFSET_FOR_KEYBOARD;
          [UIView beginAnimations:@"ResizeForKeyboard" context:nil];
          [UIView setAnimationDuration:animationDuration];
          self.view.frame = frame;
          [UIView commitAnimations];      
      }
      // Additional Code
  }
  </code></pre>
  
  <p>However, this solution has a simple flaw: When I finish editing one of the "hidden" textfields and touch another textfield, the keyboard vanishes, the view moves down, the view moves up again and the keyboard reappears.</p>
  
  <p>Is there any possibility to keep the keyboard from vanishing and reappearing between two edits (of the "hidden" textfields - so that the view only moves when the selected textfield changes from one that would be hidden by the keyboard to one that would not be hidden)?</p>