ios 动画效果类型及实现方法
来源:互联网 发布:米6 手机无法连接网络 编辑:程序博客网 时间:2024/05/22 06:13
实现iphone的动画效果主要有两种方法,一种是UIView层面的,一种是使用CATransition进行更低层次的控制.
1、UIView
CGContextRef context = UIGraphicsGetCurrentContext(); [UIView beginAnimations:nil context:context]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDelegate:self]; [UIView setAnimationDuration:1.0]; //动画持续的时间 //这里添加你对UIView所做改变的代码 //[UIView setAnimationDidStopSelector:@selector(animationFinished:)]; //动画停止后,执行某个方法 [UIView commitAnimations];
2、UIView(使用CocoaTouch)
CGContextRef context = UIGraphicsGetCurrentContext(); [UIView beginAnimations:nil context:context]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:1.0]; // Cocoa Touch [UIView setAnimationTransition: UIViewAnimationTransitionCurlUp forView:myView cache:YES]; [UIView setAnimationDelegate:self]; //[UIView setAnimationDidStopSelector:@selector(animationFinished:)]; //动画停止后,执行某个方法 [UIView commitAnimations]; 动画方式(UIViewAnimationTransition): UIViewAnimationTransitionFlipFromLeft //从左向右翻转 UIViewAnimationTransitionFlipFromRight //从右向左翻转 UIViewAnimationTransitionCurlUp //从下向上翻页 UIViewAnimationTransitionCurlDown //从上向下翻页
3、CATransition
头部导入:
CATransition *animation = [CATransition animation]; animation.delegate = self; animation.duration = 1.0f; //动画执行时间 animation.timingFunction = UIViewAnimationCurveEaseInOut; animation.type = kCATransitionFade; animation.subtype = kCATransitionFromRight; // 这里添加你对UIView所做改变的代码 [[myView layer] addAnimation:animation forKey:@"animation"];
setType:有四种类型:
kCATransitionFade //交叉淡化过渡 kCATransitionMoveIn //移动覆盖原图 kCATransitionPush //新视图将旧视图推出去 kCATransitionReveal //底部显出来
setSubtype:有四种类型:
kCATransitionFromRight; kCATransitionFromLeft(默认值) kCATransitionFromTop; kCATransitionFromBottom 注:kCATransitionFade 不支持Subtype
4、CATransition(只使用setType,参数是NSString)
CATransition *animation = [CATransition animation]; animation.delegate = self; animation.duration = 1.0f; //动画执行时间 animation.timingFunction = UIViewAnimationCurveEaseInOut; animation.type = @"suckEffect";// 这里添加你对UIView所做改变的代码 [[myView layer] addAnimation:animation forKey:@"animation"];
可以用的效果主要有:
pageCurl //向上翻一页 pageUnCurl //向下翻一页 rippleEffect //滴水效果 suckEffect //收缩效果,如一块布被抽走 cube //立方体效果 oglFlip //上下翻转效果
- ios 动画效果类型及实现方法
- iOS的动画效果类型及实现方法
- iOS的动画效果类型及实现方法
- ios学习--详解IPhone动画效果类型及实现方法
- iOS的动画效果类型及实现方法
- ios学习--详解IPhone动画效果类型及实现方法
- iOS的动画效果类型及实现方法
- iOS的动画效果类型及实现方法
- iphone的动画效果类型及实现方法
- iPhone的动画效果类型及实现方法
- iPhone的动画效果类型及实现方法
- CATransition的动画效果类型及实现方法
- iphone的动画效果类型及实现方法
- iphone的动画效果类型及实现方法
- CATransition的动画效果类型及实现方法
- CATransition的动画效果类型及实现方法
- iPhone的动画效果类型及实现方法
- iphone的动画效果类型及实现方法(收集)
- github中不加入版本控制.gitignore设定
- iOS中UITextField 使用解析
- iOS中UITextField 使用解析
- Delphi异常处理try except语句和try finally语句用法以及区别
- UIImageView控件使用详解
- ios 动画效果类型及实现方法
- CATransition转场动画
- UIView层次管理和视图切换
- Oracle数据库10个小问题
- 大学生应聘者面试遇怪题时怎么办?
- 设计模式之观察者模式
- 从 CWinThread 派生一个子类:CConnectThread,在CConnectThread中作消息映射的时候遇到问题
- 让简历成为通往面试“绿卡”
- Bluetooth设备之间如何建立连接