Shake View
- (void)wrongPasswordShakeWithCompletation:(void(^)())paraBlock
{
if(!passwordCheckAlertVC) return;
UIView *alertView = passwordCheckAlertVC.view;
[CATransaction begin];
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"];
animation.duration = 0.07;
animation.repeatCount = 3;
animation.autoreverses = YES;
animation.fromValue = [NSValue valueWithCGPoint:CGPointMake(alertView.center.x - 10, alertView.center.y)];
animation.toValue = [NSValue valueWithCGPoint:CGPointMake(alertView.center.x + 10, alertView.center.y)];
[CATransaction setCompletionBlock:^{
if(paraBlock)
{
paraBlock();
}
}];
[alertView.layer addAnimation:animation forKey:@"position"];
[CATransaction commit];
}