UINavigationController页面转化效果( CATransition animation.type 种类)

来源:互联网 发布:橡塑保温板 淘宝 编辑:程序博客网 时间:2024/06/05 02:10

@自定义UINavigationController页面转化效果

- (void)onClickstartButton:(UIButton *)button {


    CATransition *animation = [CATransition animation];

    // 响应时间

    animation.duration = 1.2;
    // 水滴效果

    animation.type = @"rippleEffect";

   // 决定动画的进度

    animation.startProgress =0.0;

    animation.endProgress =0.3;

    // 下面3个可设置可不设置
    //animation.delegate=self;
    //animation.timingFunction=UIViewAnimationCurveEaseInOut;
    //animation.timingFunction = [CAMediaTimingFunction functionWithName:@"easeInEaseOut"];
    [self.navigationController.view.layer addAnimation:animation forKey:nil];
        
    HMTTestViewController * testVC = [[HMTTestViewController alloc]init];
    [self.navigationController pushViewController:testVC animated:NO];

    [testVC release];
    

}


1.#define定义的常量 

  @property(copy)NSString *type;(页面过渡的种类)

     kCATransitionFade             交叉淡化过渡 
     kCATransitionMoveIn          新视图移到旧视图上面 
     kCATransitionPush              新视图把旧视图推出去 
     kCATransitionReveal          将旧视图移开,显示下面的新视图 

    @property(copy)NSString *subtype;(页面过渡的方向)

     kCATransitionFromRight      
     kCATransitionFromLeft
     kCATransitionFromTop
     kCATransitionFromBottom


 2.用字符串表示 

  /* 过渡效果
     fade     //交叉淡化过渡(不支持过渡方向)
     push     //新视图把旧视图推出去
     moveIn   //新视图移到旧视图上面
     reveal   //将旧视图移开,显示下面的新视图
     cube     //立方体翻滚效果
     oglFlip  //上下左右翻转效果
     suckEffect   //收缩效果,如一块布被抽走(不支持过渡方向)
     rippleEffect //滴水效果(不支持过渡方向)
     pageCurl     //向上翻页效果
     pageUnCurl   //向下翻页效果
     cameraIrisHollowOpen  //相机镜头打开效果(不支持过渡方向)
     cameraIrisHollowClose //相机镜头关上效果(不支持过渡方向)
    
*/
   
   /* 过渡方向
     fromRight;
     fromLeft;
     fromTop;
     fromBottom;
    
*/

0 0
原创粉丝点击