title: Right To Left Push animation results in corrupted navigation bar
body: <p>I'm subclassing my <code>UINavigationController</code> to perform a push from right to left (not normal behavior) with UIRTLNavigationController.m I've added at the bottom of this question and get these warnings:   </p>
  
  <pre><code> nested push animation can result in corrupted navigation bar
   Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
  </code></pre>
  
  <p>I've researched about these errors and found a class that prevents you from receiving them: <a href="https://github.com/Plasma/BufferedNavigationController" rel="nofollow">https://github.com/Plasma/BufferedNavigationController</a> </p>
  
  <p>I've added BufferedNavigationController .h and .m to my project, changed the line in BufferedNavigationController.h to: 
  @interface BufferedNavigationController : UIRTLNavigationController 
  and seted BufferedNavigationController to be my <code>UINavigationController</code> custom subclass in the IB.</p>
  
  <p>Views are still moving from right to left , methods are getting called inside BufferedNavigationController but I'm still get the warnings about nested and ..Navigation Bar subview tree might get corrupted..</p>
  
  <p>Any help would be appreciated. </p>
  
  <p><strong>UIRTLNavigationController.m:</strong></p>
  
  <pre><code>#import "UIRTLNavigationController.h"
  
  
  @implementation UIRTLNavigationController
  
  - (id)initWithRootViewController:(UIViewController *)rootViewController
  {
          self = [super initWithRootViewController:rootViewController];
          if (!self)
                  return nil;
          return self;
  }
  
  - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
  {
          NSLog(@"pushViewController");
          // Add the viewController and a fake controller without animation. Then pop the fake controller with animation.
          UIViewController *fakeController = [[[UIViewController alloc] init] autorelease];
          [super setViewControllers:[[self viewControllers] arrayByAddingObjectsFromArray:[NSArray arrayWithObjects:viewController, fakeController, nil]] animated:NO];
          [super popViewControllerAnimated:animated];
  }
  
  - (void)popViewControllerAnimatedStep2:(UIViewController *)viewController
  {
          // Push the new top controller with animation
          [super pushViewController:viewController animated:YES];
          // Remove the view that should have been popped
          NSMutableArray *arr = [NSMutableArray arrayWithArray:[self viewControllers]];
          [arr removeObjectAtIndex:[[self viewControllers] count]-2];
          [super setViewControllers:[NSArray arrayWithArray:arr] animated:NO];
  }
  
  - (UIViewController *)popViewControllerAnimated:(BOOL)animated
  {
          NSLog(@"popViewControllerAnimated");
  
          if (animated)
          {
                  // Save the controller that should be on top after this pop operation
                  UIViewController *newTopController = [[self viewControllers] objectAtIndex:[[self viewControllers] count]-2];
                  // Remove it from the stack. Leave the view that should be popped on top
                  NSMutableArray *arr = [NSMutableArray arrayWithArray:[self viewControllers]];
                  [arr removeObjectAtIndex:[[self viewControllers] count]-2];
                  [super setViewControllers:[NSArray arrayWithArray:arr] animated:NO];
                  // Schedule the next step
                  [self performSelector:@selector(popViewControllerAnimatedStep2:) withObject:newTopController afterDelay:0];
                  return [arr objectAtIndex:[arr count]-1];
          }
          return [super popViewControllerAnimated:NO];
  }
  
  - (void)dealloc {
      [super dealloc];
  }
  
  
  @end
  </code></pre>