UIAlertView的动画效果实现代码
首先要加入QuartzCore.framework
#import "QuartzCore/QuartzCore.h"
- (void)test
{
CAKeyframeAnimation * animation;
animation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
animation.duration = 0.5;
animation.delegate = self;
animation.removedOnCompletion = YES;
animation.fillMode = kCAFillModeForwards;
NSMutableArray *values = [NSMutableArray array];
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.1, 0.1, 1.0)]];
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.2, 1.2, 1.0)]];
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.9, 0.9, 0.9)]];
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 1.0)]];
animation.values = values;
animation.timingFunction = [CAMediaTimingFunction functionWithName: @"easeInEaseOut"];
[tempView.layer addAnimation:animation forKey:nil];
}
本文介绍了一种UIAlertView动画效果的实现方式,通过使用QuartzCore.framework和CAKeyframeAnimation创建了一个缩放和平滑弹动的动画。具体步骤包括设置动画的关键路径、持续时间、值等属性。
6004

被折叠的 条评论
为什么被折叠?



