https://github.com/soberZhichao/presentNextPageAnimation
- (IBAction)nextPageClick:(id)sender
{
// UIStoryboard讀取VC
UIViewController *nextVC = [[UIStoryboard storyboardWithName:@"NextViewController" bundle:nil] instantiateViewControllerWithIdentifier:@"NextViewController"];
// vc自帶的跳轉(zhuǎn)modal
// nextVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self setupPresentAnimation];
[self presentViewController:nextVC animated:NO completion:nil];
}
- (void)setupPresentAnimation
{
//創(chuàng)建動畫
CATransition *animation = [CATransition animation];
//設(shè)置運動軌跡的速度 iOS5之后新的寫法,以前的不再支持
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
//設(shè)置動畫類型為立方體動畫
animation.type = @"cube"; // 詳細(xì)動畫方式可見我的CALayer 跳轉(zhuǎn)動畫那篇
//設(shè)置動畫時長
animation.duration = 2;
//設(shè)置運動的方向
animation.subtype =kCATransitionFromRight;
//控制器間跳轉(zhuǎn)動畫
[[UIApplication sharedApplication].keyWindow.layer addAnimation:animation forKey:nil];
}