iOS页面间跳转动画效果

来源:互联网 发布:淘宝客服规范用语 编辑:程序博客网 时间:2024/06/06 03:38
页面控制器中使用方法:

    ContentViewController *cotent=[[ContentViewControlleralloc]initWithNibName:@"ContentViewController"bundle:nil];

    [CATransaction begin];

    CATransition *transition = [CATransitionanimation];

    transition.type = kCATransitionMoveIn;

    transition.subtype = kCATransitionFromBottom;


    transition.duration=0.5f;

    transition.fillMode=kCAFillModeForwards;

    transition.removedOnCompletion=YES;

    

    [[UIApplicationsharedApplication] .keyWindow.layeraddAnimation:transition forKey:@"transition"];

    [[UIApplicationsharedApplicationbeginIgnoringInteractionEvents];

    [CATransactionsetCompletionBlock: ^ {

        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(transition.duration * NSEC_PER_SEC)),dispatch_get_main_queue(), ^ {

            [[UIApplicationsharedApplicationendIgnoringInteractionEvents];

        });

    }];

    

    [selfpresentModalViewController:content animated:NO];

    

    [CATransaction commit];

此处已经可以实现效果了,可以进项目区试试  下面的是各种跳转的type


 一些动画类型:

animation.type = kCATransitionFade;

    

            animation.type = kCATransitionPush;

    

            animation.type = kCATransitionReveal;

  

            animation.type = kCATransitionMoveIn;

      

            animation.type = @"cube";

       

            animation.type = @"suckEffect";

         

            animation.type = @"oglFlip";

         

            animation.type = @"rippleEffect";

         

            animation.type = @"pageCurl";

         

            animation.type = @"pageUnCurl";

        

            animation.type = @"cameraIrisHollowOpen";

          

            animation.type = @"cameraIrisHollowClose";

          

            animation.subtype = kCATransitionFromLeft;

    

            animation.subtype = kCATransitionFromBottom;

       

            animation.subtype = kCATransitionFromRight;

     

            animation.subtype = kCATransitionFromTop;



0 0
原创粉丝点击