您始终可以使用 CGAffineTransformMakeScale 进行的缩放转换来 CGAffineTransformConcat 旋转。
如果您对另一个按钮按下效果感兴趣,我也需要一些很酷的东西,并确定了一个“悸动”动画,如下所示:
BOOL keepThrobbing = NO;
-(void)buttonThrob:(CGFloat)inset {
UIViewAnimationOptions opts = UIViewAnimationOptionBeginFromCurrentState|UIViewAnimationOptionAllowUserInteraction;
[UIView animateWithDuration:0.2 delay:0.0 options:opts animations:^{
self.button.frame = CGRectInset(self.button.frame, inset, inset);
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.2 delay:0.0 options:opts animations:^{
self.button.frame = CGRectInset(self.button.frame, -inset, -inset);
} completion:^(BOOL finished) {
if (finished && keepThrobbing) {
[self buttonThrob:inset];
}
}];
}];
}
像这样称呼它:
keepThrobbing = YES;
[self buttonThrob:10.0]; // expand/shrink by 10px in x and y