[UIView beginAnimations:@"shake" context:nil];
[UIView setAnimationDuration:0.1f];
[UIView animateWithDuration:0.1f animations:^{
// 一次动画开始时首先向左偏转
_imageView.transform = CGAffineTransformMakeRotation(-0.05);
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.1f delay:0 options:UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse | UIViewAnimationOptionAllowUserInteraction animations:^{
// 一次动画结束时向右偏转,然后一直重复进行
_imageView.transform = CGAffineTransformMakeRotation(0.05);
} completion:^(BOOL finished) {
// 动画完全结束时记得归位
_imageView.transform = CGAffineTransformMakeRotation(0);
}];
}];
[UIView commitAnimations];