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, //左翻轉
新聞熱點
疑難解答