- (void)animateIncorrectPassword:(UIView *)button {
// Clear the password field
// Animate the alert to show that the entered string was wrong
// "Shakes" similar to OS X login screen
CGAffineTransform moveRight = CGAffineTransformTranslate(CGAffineTransformIdentity, 20, 0);
CGAffineTransform moveLeft = CGAffineTransformTranslate(CGAffineTransformIdentity, -40, 0);
CGAffineTransform resetTransform = CGAffineTransformTranslate(CGAffineTransformIdentity, 0, 0);
// CGAffineTransform transform = CGAffineTransformIdentity; //申明旋转量
//transform = CGAffineTransformMakeRotation(-M_PI/2); //设置旋转量具体值
[UIView animateWithDuration:0.1 animations:^{
// Translate left
button.transform = moveLeft;
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.1 animations:^{
// Translate right
button.transform = moveRight;
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.1 animations:^{
// Translate left
button.transform = moveLeft;
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.1 animations:^{
// Translate to origin
button.transform = resetTransform;
}];
}];
}];
}];
}
抖动提示,密码输错的抖动提示
最新推荐文章于 2021-01-12 02:19:25 发布