本文主要是介绍仿 UIAlertView 弹出动画效果,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
需要引入 QuartzCore
+(void)animationWithView:(UIView *)view duration:(CFTimeInterval)duration{CAKeyframeAnimation * animation;animation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];animation.duration = duration;animation.removedOnCompletion = NO;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"];[view.layer addAnimation:animation forKey:nil];
}
这篇关于仿 UIAlertView 弹出动画效果的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!