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, //左翻转