title: how to do animated transition between different UIViewControllers within a UITabBarController?
body: <p>I have a UITabBarController,displaying 4 tabs.</p>
  
  <p>I want to add an animated UIViewController transition when user swiping screen to switch  tab. (- (void)tabBarController:(UITabBarController *)theTabBarController didSelectViewController:(UIViewController *)viewController method only work for select tab directly). transition will be in easeinout style. </p>
  
  <p>I tried following codes but not work. only coming UIViewController moves, going UIViewController doesn't show at all.(I printed all UIViewControllers' frame data, all these 4 UIViewControllers are {0,0},{320,480} )</p>
  
  <pre><code>// Get views. controllerIndex is passed. 
  UIViewController *fromVC = [_tabBarController.viewControllers objectAtIndex:startIndex];
  UIViewController *toVC = [_tabBarController.viewControllers objectAtIndex:to];
  
  UIView *fromView = fromVC.view;
  UIView *toView = toVC.view;
  
  MWLog(@"from view is %@",fromView);
  
  int direct = startIndex - to; 
  // calculate move direction.
  if (direct &lt; 0) {
  
      CGRect outFrame = fromView.frame;
      outFrame.origin.x = -320; // expect fromView will move to {-320,0}, out of screen.
      MWLog(@"fromView's frame is %@", NSStringFromCGRect(fromView.frame));
  
      CGRect inFrame = toView.frame;
      inFrame.origin.x = 0;
  
      MWLog(@"toView's frame is %@", NSStringFromCGRect(toView.frame));
  
      [UIView beginAnimations:@"moveView" context:nil];
  
      [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
      [UIView setAnimationDuration:0.5f];
  
      toView.frame = inFrame;
      fromView.frame = outFrame;
      [UIView commitAnimations];
  }else
  {
      // reverse moving. ignored....
  
  }
  </code></pre>
  
  <p>Could you tell me what's wrong and how to do it correctly? thanks in advance!</p>