CATransition 转场动画

   

subtype 转场动画 动画效果的方向

 

 type 转场动画的 动画效果

 

 kCATransitionFade   交叉淡化过渡

 kCATransitionMoveIn 新视图移到旧视图上面

 kCATransitionPush   新视图把旧视图推出去

 kCATransitionReveal 将旧视图移开,显示下面的新视图

 

 

 私有api 不建议使用 苹果不提供维护 并且有可能app审核不通过

 pageCurl            向上翻一页

 pageUnCurl          向下翻一页

 rippleEffect        滴水效果

 suckEffect          收缩效果 如一块布被抽走

 cube                立方体效果

 oglFlip             上下翻转效果

初始化: CATransition *trans = [CATransition animation];

选择动画效果:trans.type =@"oglFlip" (私有API动画效果需要写成字符串@“”)

系统给的方法不需要:trans.type = kCATransitionPush

设置动画的持续时间: trans.duration = 2;

 把动画添加到图片上:   [image.layer addAnimation:trans forKey:@"tran"];

二. 导航控制器的动画组

 nextViewController *next = [[nextViewController alloc]init];

        CATransition *animation = [CATransition animation];

        animation.type = @"suckEffect";

        animation.subtype = kCATransitionFromLeft;

        animation.duration = 1;

        [self.navigationController.view.layer addAnimation:animation forKey:@"animation"];

//        如果使用自定义的转场动画,必须禁用系统给的动画

        [self.navigationController pushViewController:next animated:NO];

 

posted on 2015-09-30 14:33  popper小P  阅读(204)  评论(0编辑  收藏  举报