视图动画
来源:互联网 发布:乐谱软件下载 编辑:程序博客网 时间:2024/05/16 14:42
1.+ (void)beginAnimations:(NSString *)animationID context:(void *)context 创建一个动画
[UIView beginAnimations:@"name" context:nil];
2.+ (void)commitAnimations 执行动画
[UIView commitAnimations];
3.+ (void)setAnimationDelay:(NSTimeInterval)delay 设置动画延迟
[UIView setAnimationDelay:2.0f];
4.+ (void)setAnimationDelegate:(id)delegate 设置动画的代理
[UIView setAnimationDelegate:self];
5.+ (void)setAnimationDidStopSelector:(SEL)selector 设置动画结束时调用的函数
[UIView setAnimationDidStopSelector:fuction];
6.+ (void)setAnimationDuration:(NSTimeInterval)duration 设置动画花费的时间
[UIView setAnimationDuration:5];
7.+ (void)setAnimationRepeatAutoreverses:(BOOL)repeatAutoreverses 设置一个动画是否可以自动重复
[UIView setAnimationRepeatAutoreverses:YES];
8.+ (void)setAnimationRepeatCount:(float)repeatCount 设置动画重复的次数
[UIView setAnimationRepeatCount:3];
9.+ (void)setAnimationStartDate:(NSDate *)startTime 设置动画开始执行的日期。
下面是一个简单的动画代码例子(在一个控制器类中,self代表控制器)
UIView view = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,460];
[UIView beginAnimations:@"move" context:nil];
[UIView setAnimationDelay:2];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:4];
[UIView setAnimationRepeatAutoreverses:YES];
[UIView setAnimationRepeatCount:3];
[UIView setAnimationDidStopSelector:afunction];
view.frame = CGRectMack(0,100,320,460);
[UIView commitAnimations];
- (void)afunction {
NSLOG(@"动画结束");
}
执行上述代码:
首先因为设置了动画延迟是2秒,所以代码执行2秒后才开始执行动画,并且设置了动画花费的时间是4s,动画重复3次,
执行动画后view视图将从原来的位置向下移动100像素,并且动画结束时调用afunction函数.
- 视图动画
- 视图动画
- 视图动画
- 视图动画
- Android动画--视图动画
- 【动画系列】视图动画
- 视图动画和帧动画
- android-属性动画、视图动画
- 属性动画和视图动画
- Android动画机制 视图动画
- Android动画之视图动画
- Android动画之视图动画
- Android 动画之视图动画
- 动画和图形:视图动画
- 实现视图的动画
- ios视图缩放动画
- ios视图缩放动画
- 视图切换动画
- android中关于dip和px以及转换的总结
- 蓝牙4.0,低功耗的秘密
- C# Ftp基础操作
- iOS越狱开发环境搭建 theos
- iframe自适应高度的多种方法方法小结
- 视图动画
- 使用struts2标签,格式化日期
- device Log:entitlement 'application-identifier' has value not permitted by a provisioning profile
- 黑马程序员——java 网路编程
- python 爬虫抓站
- UIApplication对象及其代理UIApplicationDelegate[转]
- python crawler(2)
- SIT与UAT的分别
- C#下XML文档操作