uiview封装的基本动画
2013-07-14 17:11 甘超波 阅读(481) 评论(0) 编辑 收藏 举报
基本动画的类型为
基本动画的节奏
UIViewAnimationOptionCurveEaseInOut = 0 << 16, // default
UIViewAnimationOptionCurveEaseIn = 1 << 16,
UIViewAnimationOptionCurveEaseOut = 2 << 16,
UIViewAnimationOptionCurveLinear = 3 << 16,
//转场动画的类型
UIViewAnimationOptionTransitionNone = 0 << 20, // default
UIViewAnimationOptionTransitionFlipFromLeft = 1 << 20,
UIViewAnimationOptionTransitionFlipFromRight = 2 << 20,
UIViewAnimationOptionTransitionCurlUp = 3 << 20,
UIViewAnimationOptionTransitionCurlDown = 4 << 20,
UIViewAnimationOptionTransitionCrossDissolve = 5 << 20,
UIViewAnimationOptionTransitionFlipFromTop = 6 << 20,
UIViewAnimationOptionTransitionFlipFromBottom = 7 << 20,
block动画
-(void)starBlcokAnimation{ [UIView animateWithDuration:0.25 delay:0.1 options:UIViewAnimationOptionCurveEaseInOut animations:^{ // _lastview.center=CGPointMake(100, 100); //CGAffineTransformScale ,第一个参数要缩放view ,后面参数缩放的比例 _lastview.transform=CGAffineTransformScale(_lastview.transform, 0.5, 0.5); } completion:^(BOOL finished) { NSLog(@"finish"); }]; }
头尾动画
-(void)startAniamtion{ //头尾动画 [UIView beginAnimations:@"aa" context:nil]; //设置动画时间 [UIView setAnimationDuration:0.25]; //动画执行的节奏 [UIView setAnimationCurve:UIViewAnimationCurveEaseIn]; //要设置代理 [UIView setAnimationDelegate:self]; [UIView setAnimationWillStartSelector:@selector(animationWillStart:context:)]; [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)]; _lastview.center=CGPointMake(100, 100); [UIView commitAnimations]; } -(void)animationWillStart:(NSString *)animationID context:(void *)context{ NSLog(@"animationWillStart-->%@",animationID); } -(void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context{ NSLog(@"animationDidStop-->%@",animationID); }