0

我必须以这样的方式对几个按钮进行动画处理,使其看起来像是从下方旋转到屏幕上并设法做到了这一点。为了使解决方案起作用,我需要像这样更改 viewDidLoad 上的按钮方向:

for (UIButton* button in self.shareButtons) {
    button.imageView.image = [UIImage imageWithCGImage:button.imageView.image.CGImage
                                                 scale:1.0 orientation: UIImageOrientationDownMirrored];
}

一切正常,但是当在按钮内捕获触摸时,它会取消此方向更改,并且由于动画导致按钮被“向下镜像”。

我该如何预防/避免它?

提前致谢。

4

1 回答 1

0

尝试以这种方式设置图像

[button setImage:[UIImage imageWithCGImage:button.imageView.image.CGImage
                 scale:1.0 orientation: UIImageOrientationDownMirrored]
                 forState:UIControlStateNormal];

也看看我的旋转图像的其他答案

正如评论中提到的应用变换也是一个不错的选择

button.transform = CGAffineTransformMakeRotation( ( 180 * M_PI ) / 180 );

将 UIButton 旋转 180 度。

于 2013-05-08T06:09:48.730 回答