Skip to content

Instantly share code, notes, and snippets.

@i386
Last active January 4, 2016 19:09
Show Gist options
  • Save i386/8665421 to your computer and use it in GitHub Desktop.
Save i386/8665421 to your computer and use it in GitHub Desktop.
//Setup transition on both _visibleLayer and newLayer
CATransition* transition = [CATransition animation];
transition.startProgress = 0;
transition.endProgress = 1.0;
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromRight;
transition.duration = 0.5;
[layer addAnimation:transition forKey:@"sublayers"];
//Swap layers
[self.layer replaceSublayer:_visibleLayer with:newLayer];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment