title: iOS Dismiss and Present view controller custom animation
body: <p>I have a view controller that I am presenting with the following objective c code:</p>
  
  <pre><code>CATransition *animation=[CATransition animation];
  animation.delegate=self;
  animation.duration=0.3;
  animation.type=kCATransitionMoveIn;
  animation.subtype=kCATransitionFromRight;
  
  [self presentViewController:reader animated:NO completion:nil];
  [reader.view.layer addAnimation:animation forKey:@"animation"];
  </code></pre>
  
  <p>and dismissing with similar code inside a delegate method</p>
  
  <pre><code>CATransition *animation=[CATransition animation];
  animation.delegate=self;
  animation.duration=0.3;
  animation.type=kCATransitionMoveIn;
  animation.subtype=kCATransitionFromLeft;
  
  [self dismissViewControllerAnimated:NO completion:nil];
  [self.view.layer addAnimation:animation forKey:@"animation"];
  </code></pre>
  
  <p>However there is one problem: unlike using a navigation controller where you see one view slide onto other view; here the old view just disappears instantly so the new view moves
  onto a blank view.</p>
  
  <p>How do I fix this problem? I need this code to work in IOS 6,7 and 8 and would like it to look like the horizontal animation you see when going back and forth between views that are inside navigation controllers.</p>
  
  <p>Edit:
  The solution I accepted has a bug with iOS 6, if I can find a solution that fixes it, I'll edit this post.</p>
  
  <p>Edit 2:
  Found it. It appears that since I am presenting a zBar view controller I need to use this code</p>
  
  <pre><code>zbarController.wantsFullScreenLayout=NO;
  </code></pre>
  
  <p>after I set the cameraOverlayView.</p>