title: UIViewController transition using UITabBarControllerDelegate
body: <p>I've got a UITabBarControllerDelegate set to itself for a UITabBarController.  I just want to animate the transition for the UITabBarController child view controllers.</p>
  
  <p>I'm using these methods from UITabBarControllerDelegate and UIViewControllerAnimatedTransitioning:</p>
  
  <pre><code>- (id&lt;UIViewControllerAnimatedTransitioning&gt;)tabBarController:(UITabBarController *)tabBarController animationControllerForTransitionFromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC
  {
      return self;
  }
  
  
  - (void)animateTransition:(id&lt;UIViewControllerContextTransitioning&gt;)transitionContext
  {
      UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
      UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
      UIView *container = [transitionContext containerView];
  
      [container addSubview:toViewController.view];
      [container addSubview:fromViewController.view];
  
      CGFloat screenHeight = [[UIScreen mainScreen] bounds].size.height;
  
      if ([[toViewController valueForKey:@"title"] isEqualToString:@"viewControllerTitle"]) {
          [container bringSubviewToFront:toViewController.view];
  
          [fromViewController.view setFrame:CGRectMake(0, 0, 320, screenHeight)];
          [toViewController.view setFrame:CGRectMake(320, 0, 320, screenHeight)];
  
          [UIView animateWithDuration:0.3 animations:^{
              [toViewController.view setFrame:CGRectMake(0, 0, 320, screenHeight)];
          }
                           completion:^(BOOL finished){
                               [transitionContext completeTransition:finished];
                           }];
      }
  }
  </code></pre>
  
  <p>Every lines of code above are being hit, but the result is just one black screen behind the UITabBar at the bottom, and if I remove the UITabBarControllerDelegate method to not call the transitioning context code, everything works fine.</p>
  
  <p>I'm using a similar transitioning animation code for another part of my app that's just called from a UIViewController.transitioningDelegate instead of a UITabBarController.delegate and it works fine, so I think something is different about how UITabBarControllerDelegate handles transitions.</p>
  
  <p>Can someone see why it gives me that black screen?</p>
  
  <p>Thanks in advance!</p>