-->

how to get image orientation to rotate 270 degrees

2019-09-12 15:38发布

问题:

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°.