UIImage x轴旋转

UIImage x-axis rotation

我能够使用以下代码旋转 UIImageView。

var transform = CATransform3DIdentity
transform.m34 = -1.0 / 500.0
transform = CATransform3DRotate(transform, 45.0 * .pi / 180.0, 1.0, 0.0, 0.0)
imageView.layer.transform = transform

我可以得到相同状态的 UIImage 吗?

您可以将图像转换为 CIImage,然后将 Core Image 滤镜 CIPerspectiveTransform 应用到您的图像。一点谷歌搜索发现 this article 使用该转换。