动画移动和缩放图像UIButton

sam*_*tte 2 iphone uibutton uiimageview uiimage

我希望它能够动画,所以我正在使用它 [UIView beginAnimations]

我尝试过使用动画button.imageView.frame(图像设置为imageView),但它只是动画显示位置,图像根本没有按比例缩小.

使用hateButton.frame(当图像设置为backgroundImage时),backgroundImage按比例缩小但不是动画.

如何动画缩放UIButton图像?

小智 5

您可以拨打layoutIfNeeded之间[UIView beginAnimations][UIView commintAnimations][UIView animateWithDuration].

[UIView animateWithDuration:0.3f animations:^{
    self.myButton.frame = aFrame;    
    [self.myButton layoutIfNeeded];
 }];
Run Code Online (Sandbox Code Playgroud)