title: Synchronously slide up UIView and resize UITableView when UITextField is fired
body: <p>I would to resize a <code>UITableView</code> and slide up a <code>UIView</code> that contains a <code>UITextField</code> when this field is fired. These are two simple mockups:</p>
  
  <p><img src="https://i.stack.imgur.com/8I16T.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/yOSz3.png" alt="enter image description here"></p>
  
  <p>Now I have this code:</p>
  
  <pre><code>- (void)textFieldDidBeginEditing:(UITextField *)textField
  {
      [UIView beginAnimations:nil context:NULL];
      [UIView setAnimationDelegate:self];
      [UIView setAnimationDuration:0.3];
      [UIView setAnimationBeginsFromCurrentState:YES];
  
      [myView setFrame:CGRectMake(myView.frame.origin.x, myView.frame.origin.y - 167, myView.frame.size.width, myView.frame.size.height)]; // 216 (keyboard's height) - 49 (tabbar's height) = 167
  
      [UIView commitAnimations];
  }
  
  - (BOOL)textFieldShouldReturn:(UITextField *)textField
  {
      [textField resignFirstResponder];
      [UIView beginAnimations:nil context:NULL];
      [UIView setAnimationDelegate:self];
      [UIView setAnimationDuration:0.3];
      [UIView setAnimationBeginsFromCurrentState:YES];
  
      [myView setFrame:CGRectMake(myView.frame.origin.x, myView.frame.origin.y + 167, myView.frame.size.width, myView.frame.size.height)];
  
      [UIView commitAnimations];
      return TRUE;
  }
  </code></pre>
  
  <p>The problem is that the keyboard slide up animation and the <code>myView</code> slide up animation are not synchronous. How to make these two animation perfectly synchronous?</p>
  
  <p>And how to resize the <code>UITableView</code> when the keyboard is visible and return to the original height when keyboard will hide?</p>