I was wondering if it is possible to use a CATransition within a custom Segue Transition. I created my CustomSegueTransition.m file and referenced it in my custom segue class where i want the transition to occur.
This is my code for the CustomSegueTransition.m file:
#import "CustomSegueTransition.h"
#import "QuartzCore/QuartzCore.h"
@implementation CustomSegueTransition
-(void) perform {
// set up an animation for the transition the content
CATransition *animation = [CATransition animation];
[animation setDuration:0.25];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromRight];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.25];
[UIView commitAnimations];
}
@end
It gives me no error warnings, however the transition wont perform when the button is pressed to cause the segue transition. Am i missing something in the CATransition code or is this not possible?
Thanks!
@Grant
I don't have complete answer for you, but I did notice that you never call a new view thus there is no transition. I don't know whether you are shooting for a push, pop, or modal but here is the type of code you will need to add:
UIViewController *src = (UIViewController *) self.sourceViewController;
UIViewController *dst = (UIViewController *) self.destinationViewController;
[src presentModalViewController:dst animated:YES];
or
[src presentViewController:<#(UIViewController *)#> animated:<#(BOOL)#> completion:<#^(void)completion#>];
I believe there are other problems with setting up the custom animation which I don't have an answer for though I am interested in the solution.