您的位置:首页 > 移动开发 > IOS开发

iOS笔记 页面切换 CATransition Animation动画

2016-07-23 14:26 363 查看
 CATransition *animaton = [CATransitionanimation];

// 声明

    animaton.duration =0.7; // 动画时长

    animaton.type =@"rippleEffect"; // 动画类型 

    animaton.subtype =kCATransitionFromLeft; // 过渡方向

    //animaton.timingFunction = UIViewAnimationCurveEaseInOut;

    [self.selectPaid.window.layeraddAnimation:animatonforKey:nil];
// 开始动画

// 动画类型方

1.#define定义的常量 
     kCATransitionFade   交叉淡化过渡 
     kCATransitionMoveIn 新视图移到旧视图上面 
     kCATransitionPush   新视图把旧视图推出去 
     kCATransitionReveal 将旧视图移开,显示下面的新视图 
  
2.用字符串表示 
     pageCurl            向上翻页 
     pageUnCurl          向下翻页 
     rippleEffect        滴水效果 
     suckEffect          收缩效果,如一块布被抽走 
     cube                立方体效果 
     oglFlip             上下翻转效果  

CATransition* transition = [CATransition animation];  

transition.duration = 0.5;  

transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];  

transition.type = kCATransitionFade; //kCATransitionMoveIn; //, kCATransitionPush, kCATransitionReveal, kCATransitionFade  

//transition.subtype = kCATransitionFromTop; //kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom  

[self.navigationController.view.layer addAnimation:transition forKey:nil];  

[[self navigationController] popViewControllerAnimated:NO];  

自定义navigationController push和pop界面切换动画

For Push:

[cpp] view
plain copy

 print?

MainView *nextView=[[MainView alloc] init];  

[UIView  beginAnimations:nil context:NULL];  

[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];  

[UIView setAnimationDuration:0.75];  

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

[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];  

[UIView commitAnimations];  

For Pop:

[cpp] view
plain copy

 print?

[UIView  beginAnimations:nil context:NULL];  

[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];  

[UIView setAnimationDuration:0.75];  

[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];  

[UIView commitAnimations];  

  

[UIView beginAnimations:nil context:NULL];  

[UIView setAnimationDelay:0.375];  

[self.navigationController popViewControllerAnimated:NO];  

[UIView commitAnimations];  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  iOS 正则表达式