已經掌握了CALayer下的CATransition動畫在同一個控制器下實現,但是在不同控制器間跳轉又該如何實現呢?
MyViewController *myVC = [[MyViewController alloc]init];
//創建動畫
CATransition *animation = [CATransition animation];
//設置運動軌跡的速度
animation.timingFunction = UIViewAnimationCurveEaseInOut;
//設置動畫類型為立方體動畫
animation.type = @"cube";
//設置動畫時長
animation.duration =0.5f;
//設置運動的方向
animation.subtype =kCATransitionFromRight;
//控制器間跳轉動畫
[[UIApplication sharedApplication].keyWindow.layer addAnimation:animation forKey:nil];
[self presentViewController:myVC animated:NO completion:nil];
下面附上一些常用的動畫類型:
Fade = 1,
//淡入淡出
Push,
//推擠
Reveal,
//揭開
MoveIn,
//覆蓋
Cube,
//立方體
SuckEffect,
//吮吸
OglFlip,
//翻轉
RippleEffect,
//波紋
PageCurl,
//翻頁
PageUnCurl,
//反翻頁
CameraIrisHollowOpen,
//開鏡頭
CameraIrisHollowClose,
//關鏡頭
CurlDown,
//下翻頁
CurlUp,
//上翻頁
FlipFromLeft,
//左翻轉
附上簡書大神的文章:http://www.jianshu.com/p/09b7e5ff371c
FlipFromRight,
//右翻轉
