UINavigationController自定义,push和pop动画

我自己写的一个自定义UINavigationController,可以很方便地定制UINavigationController的navigationBar背景样式,比较炫的push和pop效果,不多说,上代码。

重写-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated方法,以下是动画的关键代码

     UIView * toView = [viewControllerview];

        CABasicAnimation *Animation  = [CABasicAnimationanimationWithKeyPath:@"transform"];

       CATransform3D rotationAndPerspectiveTransform =CATransform3DIdentity;

        rotationAndPerspectiveTransform.m34 =1.0 / -1000;

        rotationAndPerspectiveTransform =CATransform3DMakeTranslation(self.view.frame.size.width,0,0);

        [Animation setFromValue:[NSValuevalueWithCATransform3D:CATransform3DMakeTranslation(self.view.bounds.size.width,00)]];

        [Animation setToValue:[NSValuevalueWithCATransform3D:CATransform3DMakeTranslation(0,0,0)]];

        [AnimationsetDuration:0.3];

        Animation.delegate =self;

        //no表示动画会保持最后的状态,yes会返回到最初的状态

        Animation.removedOnCompletion =NO;

        Animation.fillMode =kCAFillModeBoth;

        [toView.layeraddAnimation:Animation forKey:@"fromRight"];

        CABasicAnimation *Animation1  = [CABasicAnimationanimationWithKeyPath:@"transform"];

       CATransform3D rotationAndPerspectiveTransform1 =CATransform3DIdentity;

        rotationAndPerspectiveTransform1.m34 =1.0 / -1000;

        rotationAndPerspectiveTransform1 =CATransform3DMakeScale(1.0,1.01.0);

        [Animation1 setToValue:[NSValuevalueWithCATransform3D:CATransform3DMakeScale(0.95,0.95,0.95)]];

        [Animation1setDuration:0.3];

        Animation1.delegate =self;

        Animation1.removedOnCompletion =NO;

        Animation1.fillMode =kCAFillModeBoth;

        [animationLayeraddAnimation:Animation1 forKey:@"scale"];



相关项目代码例子:http://download.youkuaiyun.com/detail/a865499908/7041469

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值