push 自定义动画

-(CATransition *)MyCAnimation1:(UIView *)viewNum upDown:(BOOL )boolUpDown{

            CATransition *animation = [CATransition animation];

            animation.delegate =self;

            animation.duration =0.5f ;

            animation.timingFunction = UIViewAnimationCurveEaseInOut;

            animation.fillMode = kCAFillModeForwards;

            animation.endProgress =1;

            animation.removedOnCompletion =NO;

            animation.type =@"pageCurl";//101

           if (boolUpDown) {

                animation.subtype = kCATransitionFromRight;

            }else{

                animation.subtype = kCATransitionFromLeft;

            }

            

           return animation;

        }

        //加载到UINavigationConroller

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

        //本身动画要取消

       //推入

        [self.navigationControllerpushViewController:@"控制器对象" animated:NO];

       //返回

        [self.navigationControllerpopViewControllerAnimated:NO];


- (IBAction)CustomPushview {  //自定义切换动画效果
    CATransition *animation = [CATransition animation];
    [animation setDuration:3.3];
    [animation setType:kCATransitionFade]; //淡入淡出
    [animation setSubtype:kCATransitionFromLeft];
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];
    MapViewController *mapview = [[MapViewController alloc] initWithNibName:Nil bundle:NULL];
    [self.navigationController pushViewController:mapview animated:NO];
    [self.navigationController.view.layer addAnimation:animation forKey:nil]; 
    
}



 

其他的动画效果可以自己去更改上面的一些动画属性和参数




  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值