有什么方法可以在没有按钮旋转的情况下旋转 UIButton 图像?

Is any way to rotate UIButton Image without Button Rotation?

我只想旋转按钮图像而不旋转按钮。我的代码是:

self.toggle.transform = CGAffineTransform(rotationAngle: .pi/4)

怎么样:

self.toggle.imageView?.transform = CGAffineTransform(rotationAngle: .pi/4)