title: Push Segue animation without UINavigationController
body: <p>I'm trying to add a simple push animation between UIViewControllers using a custom segue.</p>
  
  <p>(Without converting my controllers to use a UINavigationController)</p>
  
  <p>The answers found so far work fine with a navigation controller, but fail when not using a navigation controller.  (I am still reading and trying other answers I've seen here on stack-overflow)</p>
  
  <p>My custom segue .m thanks to (ZHCustomSegue.m) Zakir on 7/5/12</p>
  
  <pre><code>#import "SFCustomSegue.h"
  #import "QuartzCore/QuartzCore.h"
  
  @implementation SFCustomSegue
  
  
  -(void)perform {
  
  UIViewController *sourceViewController = (UIViewController*)[self sourceViewController];
  UIViewController *destinationController = (UIViewController*)[self destinationViewController];
  
  CATransition* transition = [CATransition animation];
  transition.duration = 4.0;
  transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
  transition.type = kCATransitionPush;
  transition.subtype = kCATransitionFromRight;
  
  [sourceViewController.view.layer addAnimation:transition forKey:kCATransition];
  
  [sourceViewController presentViewController:[self destinationViewController] animated:NO completion:nil];
  
  }
  </code></pre>
  
  <p>If I use a navigation controller as per Zakir's original example and replace the last 2 lines with:</p>
  
  <pre><code>    [sourceViewController.navigationController.view.layer addAnimation:transition
                                                              forKey:kCATransition];
  
  [sourceViewController.navigationController pushViewController:destinationController animated:NO];    
  </code></pre>
  
  <p>It works....</p>
  
  <p>Apple's doc says (notice not a navigation controller, and using a modal segue):</p>
  
  <pre><code>- (void)perform
  {
  // Add your own animation code here.
  
  [[self sourceViewController] presentModalViewController:[self destinationViewController] animated:NO];
  }
  </code></pre>
  
  <p>By NOT Working, I get no animation.  In Zakir's code, using 4.0 seconds it takes 4.0 seconds and I get the animation I want.  Of course, if I use a navigation controller a push tranition is the default.  In this code, I get no animation and it takes 0 seconds.</p>
  
  <p>Has anyone gotten custom segue animations to work with UIViewControllers?</p>