标签:
QQ空间在输错帐号或密码时会一左一右晃动,这种动画可使用关键帧动画实现。
- (void)shakeView:(UIView *)view { CAKeyframeAnimation *shakeAnimation = [CAKeyframeAnimation animation]; shakeAnimation.keyPath = @"transform.translation.x"; CGFloat margin = 10; shakeAnimation.values = @[@(0), @(-margin), @(margin), @(0)]; shakeAnimation.duration = 0.125; shakeAnimation.repeatCount = 2; [view.layer addAnimation:shakeAnimation forKey:nil]; }
iOS 8:CAKeyframeAnimation实现界面晃动动画
标签:
原文地址:http://www.cnblogs.com/michaellfx/p/4179083.html