UIViewAnimation动画与Core Animation的CATransition类动画
2015-08-11 10:27
309 查看
1.使用UIView类函数实现:
//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]; //提交动画
2.使用CATransition对象来实现:
CATransition比较强大,一般可以使用CATransition模拟UIView的动画。
/* 过渡效果
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"];
转自:http://www.cnblogs.com/project/archive/2011/09/27/2193556.html
//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]; //提交动画
2.使用CATransition对象来实现:
CATransition比较强大,一般可以使用CATransition模拟UIView的动画。
/* 过渡效果
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"];
转自:http://www.cnblogs.com/project/archive/2011/09/27/2193556.html
相关文章推荐
- poj 2031 Building a Space Station【最小生成树prime】【模板题】
- session与request
- 杭电 1503 Advanced Fruits(lcs)
- UITextField
- POJ3061---Subsequence(尺取法)
- 使用 RHEV APT 在 WINDOWS 虚拟机上自动化 GUEST 相关的操作
- [LeetCode] Implement Queue using Stacks
- 20+ Docs and Guides for Front-end Developers (No. 5)
- ### Error querying database. Cause: org.postgresql.util.PSQLException: 大型对象无法被使用在自动确认事物交易模式。
- RED HAT ENTERPRISE VIRTUALIZATION GUEST 代理和驱动简介
- java.util.Queue用法
- UITableview 的自适应高度
- 如何更新RHEV平台的GUEST代理和驱动
- DEBUG org.quartz.core.QuartzSchedulerThread - batch acquisition of 0 triggers
- RHEV平台中如何为 WINDOWS 虚拟机配置单点登录
- Algorithms-63.Unique Paths II
- unique() 去重函数
- iOS开发之使用Storyboard预览UI在不同屏幕上的运行效果
- 15-StringBuffer-13-常用对象API(StringBuilder类-练习)
- UILabel控件Origin值设置细节