每次用户单击按钮在swift中旋转图像5度
我正在为一个项目创建一个自定义图像编辑器,但我一直在向前和向后旋转图像 5 度。 这是我到目前为止所尝试过的,
1. self.cropImageView.transform =
self.cropImageView.transform.rotated(by: CGFloat(Double(5) *
.pi/180))
2. self.cropImageView.transform =
CGAffineTransform(rotationAngle: CGFloat(Double(5) * .pi/180) )
这是一种情况下图像仅旋转一次的问题,而在另一种情况下,图像旋转但图像尺寸随着我旋转而变小。
I am creating a custom image editor for a project where I am stuck at rotating images by 5 degrees forward and backward.
here is what I have tried so far
1. self.cropImageView.transform =
self.cropImageView.transform.rotated(by: CGFloat(Double(5) *
.pi/180))
2. self.cropImageView.transform =
CGAffineTransform(rotationAngle: CGFloat(Double(5) * .pi/180) )
Here is the issue in 1 case image only rotates one time and in another case, the image rotates but the image size is getting smaller as I rotate it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
代码只会旋转imageView,如果图像大小更改,则可能错过了一些代码。
The code will only rotate the imageView,if the image size changes,you may have missed some code.