how to get image orientation to rotate 270 degrees (swift3)

99封情书 提交于 2019-12-12 02:34:07

问题


Right now this code will only rotate my image 90 degrees. I can not figure out how to rotate it 270 degrees.

        transform = transform.rotated(by: CGFloat(Double.pi))

回答1:


Start with some basic math.

360° = 2π. 180° = π. 90° = π/2. 270° = 3π/2.

This means your posted code is rotating 180 degrees.

Use Double.pi/2 for 90° and 3*Double.pi/2 for 270°.



来源:https://stackoverflow.com/questions/43619944/how-to-get-image-orientation-to-rotate-270-degrees-swift3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!