-(void) shake {
// "Shakes" similar to OS X login screen
CGAffineTransform moveRight = CGAffineTransformTranslate(CGAffineTransformIdentity, 20, 0);
CGAffineTransform moveLeft = CGAffineTransformTranslate(CGAffineTransformIdentity, -20, 0);
[UIView animateWithDuration:0.1 animations:^{
// Translate left
self.transform = moveLeft;
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.1 animations:^{
// Translate right
self.transform = moveRight;
} completion:^(BOOL aFinished) {
[UIView animateWithDuration:0.1 animations:^{
// Translate left
self.transform = moveLeft;
} completion:^(BOOL afinished) {
[UIView animateWithDuration:0.1 animations:^{
// Translate to origin
self.transform = CGAffineTransformIdentity;
}];
}];
}];
}];
}
类似Mac 登录不成功的shake效果
猜你喜欢
转载自xiaoxuejie.iteye.com/blog/1750172
今日推荐
周排行