我正在使用 CGAffineTransformMakeRotation
旋转 UIImageView
。旋转工作正常。当我尝试将该图像获取到另一个 UIImageView
时,旋转不起作用。
编码1:
@IBAction func rotateAcn(sender: UIButton) {
rotatingImageVw.transform = CGAffineTransformMakeRotation(0.22)
}
输出1
编码2:
@IBAction func getRotatedImage(sender: UIButton) {
newImageView.image = rotatingImageVw.image
}
输出2
不知道为什么会出现这种情况?我需要 输出 2 如 输出 1 中所示。请指导我如何解决这个问题?
最佳答案
Swift 5 的解决方案:
rotatingImageVw.transform = rotatingImageVw.transform.rotated(by: CGFloat(Double.pi / 4))
关于swift - 使用 CGAffineTransformMakeRotation 时 UIImageview 旋转不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40194355/