UIViewAnimation动画与Core Animation的CATransition类动画
2015-11-17 23:46
423 查看
UIViewAnimation动画与Core Animation的CATransition类动画
//UIViewAnimationTransitionFlipFromLeft, 向左转动//UIViewAnimationTransitionFlipFromRight, 向右转动
//UIViewAnimationTransitionCurlUp, 向上翻动
//UIViewAnimationTransitionCurlDown, 向下翻动
[UIView beginAnimations:@"animationID" context:nil];
[UIView setAnimationDuration:0.5f]; //动画时长
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];
//在这里写你的代码.
[UIView commitAnimations]; //提交动画
/* 过渡效果
fade //交叉淡化过渡(不支持过渡方向)
push //新视图把旧视图推出去
moveIn //新视图移到旧视图上面
reveal //将旧视图移开,显示下面的新视图
cube //立方体翻滚效果
oglFlip //上下左右翻转效果
suckEffect //收缩效果,如一块布被抽走(不支持过渡方向)
rippleEffect //滴水效果(不支持过渡方向)
pageCurl //向上翻页效果
pageUnCurl //向下翻页效果
cameraIrisHollowOpen //相机镜头打开效果(不支持过渡方向)
cameraIrisHollowClose //相机镜头关上效果(不支持过渡方向)
*/
/* 过渡方向
fromRight;
fromLeft;
fromTop;
fromBottom;
*/
CATransition *animation = [CATransition animation];
animation.delegate = self;
animation.duration = 0.5f; //动画时长
animation.timingFunction = UIViewAnimationCurveEaseInOut;
animation.fillMode = kCAFillModeForwards;
animation.type = @"cube"; //过度效果
animation.subtype = @"formLeft"; //过渡方向
animation.startProgress = 0.0 //动画开始起点(在整体动画的百分比)
animation.endProgress = 1.0; //动画停止终点(在整体动画的百分比)
animation.removedOnCompletion = NO;
[self.view.layer addAnimation:animation forKey:@"animation"];
相关文章推荐
- UIScrollView的使用大全
- UITableView的使用大全
- OPEN CASCADE Curve Continuity
- UIView圆角
- EasyUI 在mvc中的引入与使用
- UILabel的各种属性与方法的使用
- 解决dpkg: ../../src/packages.c:227: process_queue: Assertion `dependtry <= 4' failed
- UISlider
- 王学岗属性动画上(四)------ValueAnimator的应用
- LeetCode Longest Increasing Subsequence DP
- ios8 UITableView设置 setSeparatorInset:UIEdgeInsetsZero不起作用的解决办法
- Lesson2.2 & 2.3 Maya command reference & quick help
- LeetCode303——Range Sum Query - Immutable
- {Effective Java} Quick Guide
- 20151117《Unix环境高级编程》文件apue.h的获取与使用
- Quicksort
- duilib 如果获取listui 当前选择的项GetCursel
- 线段树(updata+query)
- LXC+PBS+集群调度 msg: 'Bad UID for job execution MSG=connection to mom timed out'
- UI Button