title: Keyboard Animation Issues When Calling becomeFirstResponder within a Modal View Controller
body: <p>I've been having some issues with calling <code>-becomeFirstResponder</code> on a <code>UITextField</code> contained with a view controller that is presented modally. I call this method in the modal view controller's <code>-viewDidLoad</code> method so that the keyboard is immediately displayed. What I expected is for both the keyboard and the modal view controller to animate from up the bottom of the screen at the same time. However, what I'm observing is the following:</p>
  
  <ol>
  <li>There is a ~0.2 second UI lag between clicking the button that calls the <code>-presentModalViewController:animated:</code> method on the parent view controller and when the child view controller begins to animate modally.</li>
  <li>The keyboard is immediately presented with absolutely no animation as soon as the modal view controller's animation begins.</li>
  <li>Once the modal view controller's animation is complete, everything else seems to operate smoothly.</li>
  <li>Dismissing the modal view controller results in it being smoothly animated off screen (along with the keyboard, coincidentally).</li>
  <li>Clicking the button that presents the modal view controller any time after the first time results in the same pattern except that there is no ~0.2 second UI lag.</li>
  </ol>
  
  <p>It's as if the keyboard's animation and the modal view controller's animation are both competing for some lower-level Core Animation resource at the same time, but I don't see why this should be happening. What further seems to corroborate this hunch is if I don't ask the <code>UITextField</code> to become the first responder (i.e., if I don't ask the keyboard to present itself), then there is absolutely no UI lag, and the modal view controller animates instantly.</p>
  
  <p>Interestingly, if I do something like <code>[self.textField performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0.0001];</code> then the animation of the keyboard happens nearly at the same time as the modal view controller's animation -- it's extremely difficult to tell that they aren't both being animated at the exact same time when running on the iPhone Simulator. However, when running on an actual device, it's easily noticeable that the keyboard doesn't appear until after the modal view controller is presented. Importantly, though, there's no more UI lag.</p>
  
  <p>Has anyone experienced anything similar to this?</p>